1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| public class Client extends JFrame{
/**
*
*/
private static final long serialVersionUID = 8493067657685235377L;
private String [] cols = {"Label","Word/Raw", "Value/Raw","AC suppression ratio"};
private DefaultTableModel listData = new DefaultTableModel(cols, 0);
private JTable tblMess = new JTable(listData);
private JScrollPane panTable = new JScrollPane(tblMess);
private String [] cols1 = {"Label","ZCO_TOF", "ZCO_Q","Q_TOF"};
private DefaultTableModel listData1 = new DefaultTableModel(cols1, 0);
private JTable tblMess1 = new JTable(listData1);
private JScrollPane panTable1 = new JScrollPane(tblMess1);
private String [] cols2 = {"Label","E_Time", "E_PID","Time_PID"};
private DefaultTableModel listData2 = new DefaultTableModel(cols2, 0);
private JTable tblMess2 = new JTable(listData2);
private JScrollPane panTable2 = new JScrollPane(tblMess2);
private JPanel panPage = new JPanel();
private JPanel panCrys = new JPanel();
private JPanel panNwall = new JPanel();
private JPanel panDiamant = new JPanel();
public Client(){
// Initialisation de la fenêtre
this.setSize(1400,1100);
this.setTitle("Interface utilisateur");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
initControles();
}
private void initControles ()
{
// Définition de l'état initial des contrôles
JPanel zoneClient = (JPanel) this.getContentPane();
zoneClient.setLayout(new BorderLayout());
tblMess.setRowHeight(35);
tblMess1.setRowHeight(35);
tblMess2.setRowHeight(35);
tblMess.setFont(new Font("Serif", Font.PLAIN,18));
tblMess1.setFont(new Font("Serif", Font.PLAIN,18));
tblMess2.setFont(new Font("Serif", Font.PLAIN,18));;
panPage.setLayout (null);
panPage.setBackground(Color.lightGray);
panPage.setBorder(BorderFactory.createTitledBorder("LogFileDataCheck"));
panTable.setBounds(10, 80, 650, 960);
panTable.setBorder(BorderFactory.createTitledBorder("Crystaux"));
panTable1.setBounds(720, 80, 650, 450);
panTable1.setBorder(BorderFactory.createTitledBorder("NWall"));
panTable2.setBounds(720, 585, 650, 450);
panTable2.setBorder(BorderFactory.createTitledBorder("Diamant"));
panPage.add(panTable);
panPage.add(panTable1);
panPage.add(panTable2);
zoneClient.add(panPage);
Thread t = new Thread();
t.start();
try {
t.sleep(3000);
try {
Interface client = (Interface) Naming.lookup("rmi://localhost:1099/Client");
//Affichage du contenu du Vecteur "Detecteur"
Vector<Detecteur> v=client.vDetect();
for (Detecteur d:v){
if (d.getNom().contains("Crys"))
{
System.out.println("bla");
Object [] mess = {d.getNom(),d.getWord(),d.getValue(),d.getRatio(),new String()};
listData.addRow(mess);
}
else if (d.getNom().contains("NWall"))
{
tblMess1.removeAll();
Object [] mess1 = {d.getNom(), d.getZcq_tof(), d.getZcq_q(), d.getQ_tof(), new String()};
listData1.addRow(mess1);
}
else
{
tblMess2.removeAll();
Object [] mess2 = {d.getNom(), d.getE_time(), d.getE_pid(),d.getTime_pid(),new String()};
listData2.addRow(mess2);
}
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
public static void main(String[] args) {
Client fenetre = new Client();
fenetre.setVisible(true);
System.out.println("bla"); |
Partager