Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JTable in JComboBox

 
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
 
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
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic