l***r 发帖数: 459 | 1 I have a button and a JTable. I want to set button to enable if user type or
change content one row in table. Which listenser should I use? I implement
KeyTyped in table but it doesn't work.
Thanks! |
s***m 发帖数: 28 | 2 May be you can try to look at TableModelListener interface. You may be able to
capture the event in tableChanged interface method.
【在 l***r 的大作中提到】 : I have a button and a JTable. I want to set button to enable if user type or : change content one row in table. Which listenser should I use? I implement : KeyTyped in table but it doesn't work. : Thanks!
|
h******b 发帖数: 312 | 3 myJTable.addMouseListener(myMouseListener);
.....
//inner class
class myMouseListener extends MouseAdapter(MouseEvent e){
public void mouseClicked(MouseEvent e){
if(myJTable.getSelectedRow() != -1) myButton.setEnabled(true);
}
}
this should work, but check my typings, in a hurry, hehe!
Good luck!
Haibo
to
or
【在 s***m 的大作中提到】 : May be you can try to look at TableModelListener interface. You may be able to : capture the event in tableChanged interface method.
|