File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable in JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable in JComboBox" Watch "JTable in JComboBox" New topic

JTable in JComboBox

Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
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,
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
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
I agree. Here's the link:
subject: JTable in JComboBox
It's not a secret anymore!