aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to make an editor for a boolean JTable column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to make an editor for a boolean JTable column" Watch "How to make an editor for a boolean JTable column" New topic
Author

How to make an editor for a boolean JTable column

Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 241
    
    1

I'm in the process of making an attendance application. Right now, I'm working on building the table that will hold the students and allow the user to mark students as absent/present.
The compilable and runnable code below displays my current JTable. It looks how I want it to, but I'm uncertain about how to make the check boxes selectable and also how to gather the check boxes' boolean values. I've read the Java tutorial on this matter, but I didn't really understand it. Can someone explain it to me simply?
Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 241
    
    1

Never mind, all I had to do was override the method isEditable().
m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 157
1. your AbstractTableModel missing to override two important methods, otherwise isnt possible to change true to false,

- isCellEditable(otherwise editor isnt allowed)

- setValueAt(otherwise value isnt stored to theAbstractTableModel)

2. Id be suggest to starting with DefaultTableModel, then transfom required override to the AbstractTableModel


3. for your idea and code structure isnt required to use AbstractTableModel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make an editor for a boolean JTable column