wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes MultipleSelect JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "MultipleSelect JComboBox" Watch "MultipleSelect JComboBox" New topic
Author

MultipleSelect JComboBox

Archana Menon
Greenhorn

Joined: Sep 03, 2006
Posts: 6
I am looKing to create a combobox that allows me to select more than one value at a time, but also allows me to set some items as unselectable. does anyone have any clue how i can do this using my own renderer. i have attempted to do this and failed miserable. i have yet to get anywhere which looks like progress. any help would be greatly appreciated.

i could use a JList if it is not possilbe with a jcombobox, but i need it to look like a jcomobox with the drop down arrow and such at the side. thanks in advance
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Archana Menon
Greenhorn

Joined: Sep 03, 2006
Posts: 6
Originally posted by Craig Wood:






Hai Craig,
A bunch of Thanks for the code.Proved really useful.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Archana Menon said:
i require a way through which i can select nearly 20 items in a single stretch using ctrl+A key.
Making multiple selections is easy enough with the approach used below.
For specific use of the Ctrl-A keystroke you may be better off with a plain JList, ie, not using the renderer and list selection listener shown below. You can comment them out to see which option you like.
JList comes with a lot of keyboard support which you can find summarized here: Java Look and Feel Guidelines. In the left frame scroll down to the section Appendex A: Keyboard Navigation and click on the Lists link below it.
You have all of this with the basic JList and without the renderer and SelectionManager classes. Using the renderer and SelectionManager interfere with the default keyboard support.
Archana Menon
Greenhorn

Joined: Sep 03, 2006
Posts: 6
Originally posted by Craig Wood:
Archana Menon said:
i require a way through which i can select nearly 20 items in a single stretch using ctrl+A key.
Making multiple selections is easy enough with the approach used below.
For specific use of the Ctrl-A keystroke you may be better off with a plain JList, ie, not using the renderer and list selection listener shown below. You can comment them out to see which option you like.
JList comes with a lot of keyboard support which you can find summarized here: Java Look and Feel Guidelines. In the left frame scroll down to the section Appendex A: Keyboard Navigation and click on the Lists link below it.
You have all of this with the basic JList and without the renderer and SelectionManager classes. Using the renderer and SelectionManager interfere with the default keyboard support.


Hai Craig,
Thanks a lot.The code meets my requirement.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MultipleSelect JComboBox
 
Similar Threads
JcomboBox
Address Bar Component
JComboBox internals
JTable - URGENT !!!!
JTable - firing events