How can I achive multiple column display in a JCombobox?

Sandip Chitale

Use JTable a the CellRenderer/CellEditor.

For example look at the JTreeTable example at the SwingConnection for how a JTree is used as a TableCellRenderer for the JTable to create a TreeTable.

http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html

Similarly look at the sample SwingSet program sourcecode. It is bundled with the JDK1.2 under demo/jfc/SwingSet/src directory. There you will find an example (TreeCombo.java) which uses a TreeTableModel and a combination of JLabel + indent border to give an impression of a tree in the dropdown.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact