thank's for your help!!
that's true but the problem is that the application check if some row is selected after the creation...so nothing is selected!!
I need an event to check the selection when a mouse click come.
if can help me again...
very thanks!!
bye
Jrbpinto
this is my code...i've no compilation problems and the result is quite ok.
the problem is that components in JPanel dx are not shown!!! only when i put mouse-cursor out of the window this components are shown!!
this is what i don't understand!!!!!
CODE:
jtable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel rowSM = jtable.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
//Ignoro messaggi extra
if (e.getValueIsAdjusting()) return;
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
if (lsm.isSelectionEmpty()) {
int i=1; //non fare niente non c' selezione
} else {
int selectedRow = lsm.getMinSelectionIndex();
dx.removeAll();
JTextField CurrentMac= new JTextField();
Machine current = new Machine(selectedRow+1,c);
ResMsg res = Machine.GetResMsg();
switch(res.GetResult()){
case 5:
CurrentMac.setText("\n I/O ERROR: check your connection!");
dx.add(CurrentMac);
break;
default:
dx.removeAll();
if (res.GetMsg() != null) {
if (res.GetMsg().getType() == GIMsg.GIMACSTSR) {
MacStsRMsg rMsgM = (MacStsRMsg) res.GetMsg();
int cmds = rMsgM.getItems();
CurrentMac.setBorder(null);
CurrentMac.setEditable(false);
CurrentMac.setSelectionColor(new java.awt.Color (250, 250, 220));
CurrentMac.setBackground(new java.awt.Color (250, 250, 220));
CurrentMac.setForeground(new java.awt.Color (0, 0, 255));
CurrentMac.setText("MACHINE ID: " + rMsgM.getMId());
dx.add(CurrentMac);
JCheckBox[] check = new JCheckBox[cmds];
for (int j = 0; j < cmds; j++) {
check[j] = new JCheckBox(rMsgM.getCIdAt(j) + ": " + rMsgM.getCNameAt(j));
dx.add(check[j]);
}
}
else{
CurrentMac.setText("ERROR: Wrong response");
dx.add(CurrentMac);
}
}
else{
CurrentMac.setText("ERROR: Connection error");
dx.add(CurrentMac);
}
break;
}
}
}
});
bye & thank's
JRBPinto