Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to place JTable in JComboBox  RSS feed

 
kamalakar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need the JComboBox to show not one set of values but a pair of values. I need to override the default way in which the values are shown. I need to display more than one column of data.So basically a JTable should be shown within a JComboBox's drop down list.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"kamalakar",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
PierreArnaud Galiana
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this: subclass a JTable, make it implement the ListCellRenderer interface, and attach this to your JComboBox using the setRenderer method.
[This message has been edited by PierreArnaud Galiana (edited June 22, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!