Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable in JComboBox

 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a Date Control similar to Microsoft's Date/Time Picker, but I can't seem to get the table to show when I click on the Drop Down arrow on the ComboBox. I'm not sure if I should be using a calendar (JTable) as the Renderer or the Editor. Has anyone tried doing this before?
Any help is appreciated,
Jeremy
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it right, that you want the items displayed as table inside the _poped up_ combobox? I just consulted the API and as i understand it, the renderer (which would have been the one to use) and the editor both are only applied to the ComboBoxField. that is, i'd say, the field you see any time (a JTextField as it seems).
if you just want to display more than one value in one row without the looks of a JTable then you should implement this feature in your ComboBoxModel.
if you want to really have a jtable inside a combobox (and not just one tablerow after another) then you will have to take a closer look at the ComboBoxUI and its subclasses. look for the popup of the combobox (something like createPopup()).
have fun
chantal
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic