File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How to add different Comobox in each cell of a Column in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to add different Comobox in each cell of a Column in JTable" Watch "How to add different Comobox in each cell of a Column in JTable" New topic
Author

How to add different Comobox in each cell of a Column in JTable

buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

I have a JTable with Column 1 as a JComboBox Editor.
Now when I am using that, for column 1 each column is taking same set of ComboBox Items. But I want each column to take different items for ComboBox.
I am using
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Extend DefaultCellEditor. Override getTableCellEditorComponent. Call super.getTableCellEditorComponent(...), cast the result to JComboBox, then set the model for that combo box:
You'll need to write the code to determine / find / create the model yourself, but this is the basic idea.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to add different Comobox in each cell of a Column in JTable
 
Similar Threads
Jtable combo box issue
Swing JCombobox and JTable issue
JTable
JTable
JTable