Two Laptop Bag*
The moose likes Swing / AWT / SWT and the fly likes Combo box selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Combo box selection" Watch "Combo box selection" New topic
Author

Combo box selection

Cathy Song
Ranch Hand

Joined: Jul 01, 2003
Posts: 92
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

Joined: Apr 30, 2003
Posts: 820

JComboBoxes are single selection. For multiple selection, use a JList
Cathy Song
Ranch Hand

Joined: Jul 01, 2003
Posts: 92
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

Joined: Apr 30, 2003
Posts: 820

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

Joined: Jul 01, 2003
Posts: 92
Thanks for your reply Tim.

-Cathy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Combo box selection
 
Similar Threads
combo box length
key listener for editable combo box.
JComobBox mouse problem
Separator in combo box
JComboBox Problem...Help