• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTabel event handling

 
Jay Mistry
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to build a table with all the cells non-editable, but selectable so that I can pop up a dialog box or a window when a user clicks somewhere on the table with more information about that cell. What will be the best way to do this? I ask this because I am very new to Swing and especially JTabels.
I am also trying to implement some features that will allow individual users to save their environment settings so that they can change the look and feel and keep it. I don't know how to go about doing this except that I can either use Property files or user XML. Are there any tutorials on the web that I could look at?
I would really appreciate your help
Thanyou very much.
------------------
 
Toshifumi Ishii
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTable itself already has ListSelctionEvent.
public void valueChanged(ListSelectionEvent e) {
DefaultListSelectionModel select=(DefaultListSelectionModel)e.getSource() ;
super.valueChanged(e) ;
if ( select.isSelectionEmpty()==true) {
System.out.println("false " + getSelectedRow() +
" " + getSelectedColumn() ) ;
return ;
}
System.out.println( getSelectedRow() + " " + getSelectedColumn() ) ;
// **** Your PopUp window code ****
}
I hope it will help you, Jay-san.....
 
selvas kumars
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
for making the cells to be noneditable make
isCellEditable(row, column) method of DEfaultTableModel to return false.
Regards,
silva.
 
Jay Mistry
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Toshifumi and Selvas.
Jay
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!