• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Combo box selection

 
Cathy Song
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I was wondering if it is possible to select more than one items in a combo box (using ctrl key).

Thanks,
Cathy.
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JComboBoxes are single selection. For multiple selection, use a JList
 
Cathy Song
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank for your reply David.

Instead of having to scroll, can I make the list have a pull down feature like
combo box. I want a component that would be pull down and allow multiple selection. Will I need to create a custom component?

Thanks,
Cathy.
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you want to use a JComboBox to trigger a little popup screen. This is done with the ComboPopup interface:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/plaf/basic/ComboPopup.html

A good example of this in use is the DateComboBox:
here is the code to that:
http://www.developer.com/java/article.php/735291

if you load that and run it, you can imagine your list component in the popup instead of their date component.
[ May 20, 2004: Message edited by: Tim McGuire ]
 
Cathy Song
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Tim.

-Cathy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic