|
|
JComboBox #2
Can anyone point me to example code that allows me to have a
multi-column popup menu for a JComboBox. For example I want to show
100 items in a 10 column 10 items per column scenario instead of a
single column. Also I don't want to use a JTable for the component
that would popup when you hit the JComboBox button.
Thanks,
Jonathan
|
|
0
|
|
|
|
Reply
|
jonathanm
|
6/7/2004 5:16:50 PM |
|
> Can anyone point me to example code that allows me to have a
> multi-column popup menu for a JComboBox. For example I want to show
> 100 items in a 10 column 10 items per column scenario instead of a
> single column. Also I don't want to use a JTable for the component
> that would popup when you hit the JComboBox button.
you should implement custom ListCellRenderer.
Extend DefaultListCellRenderer and use JLabels to render columns.
--
http://uio.dev.java.net
http://reader.imagero.com
|
|
0
|
|
|
|
Reply
|
ak
|
6/7/2004 6:04:09 PM
|
|
"ak" <spam@imagero.com> wrote in message news:<ca2amp$6qr$1@online.de>...
> > Can anyone point me to example code that allows me to have a
> > multi-column popup menu for a JComboBox. For example I want to show
> > 100 items in a 10 column 10 items per column scenario instead of a
> > single column. Also I don't want to use a JTable for the component
> > that would popup when you hit the JComboBox button.
>
> you should implement custom ListCellRenderer.
> Extend DefaultListCellRenderer and use JLabels to render columns.
Thanks for the tip, but what about displaying the JLabels in a 10x10
view. How can I tell the popup to display in a multi-column fashion
versus a single column?
|
|
0
|
|
|
|
Reply
|
jonathanm
|
6/8/2004 6:46:39 PM
|
|
> > > Can anyone point me to example code that allows me to have a
> > > multi-column popup menu for a JComboBox. For example I want to show
> > > 100 items in a 10 column 10 items per column scenario instead of a
> > > single column. Also I don't want to use a JTable for the component
> > > that would popup when you hit the JComboBox button.
> >
> > you should implement custom ListCellRenderer.
> > Extend DefaultListCellRenderer and use JLabels to render columns.
>
> Thanks for the tip, but what about displaying the JLabels in a 10x10
> view. How can I tell the popup to display in a multi-column fashion
> versus a single column?
ListCellRenderer has only one method:
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
you return one Container which should contain 10 children!
Values for children you should take from second argument (Object value).
--
http://uio.dev.java.net
http://reader.imagero.com
|
|
0
|
|
|
|
Reply
|
ak
|
6/8/2004 6:57:49 PM
|
|
|
3 Replies
228 Views
(page loaded in 0.066 seconds)
Similiar Articles: JComboBox - knowing when the selection has changed - comp.lang ...I tried using ActionEvent to do this, but it wants to fire when the component first shows up. (Can I prevent this initial firing?) I then tried Item... JComboBox Multiple Selection - comp.lang.java.guiClient want to JComboBox Multiple Selection how i can modify JComboBox so any one can select multiple items please suggest me. thanks yashhnb ... setting size of JComboBox - comp.lang.java.guiHas anyone ever had issues with setting the preferred size of a JComboBox using GridBagLayout? It seems the box's height is larger than the JText... Problem of JTable and the JComboBox cell editor. - comp.lang.java ...I made a JTable object named tabel And set one of its columns with JComboBox as CellEditor. When mouse clicked on the JComboBox cell, code "table.getS... keep open JComboBox drop-down list - comp.lang.java.guiCell renderer and font problem is solved by calling JComboBox#setFont() method from within the renderer mothod. Thanks again all the people who gave t... disable jcombobox item - comp.lang.java.guiHi all, I would like to disable an item in a JComboBox. By "disable" I mean to grey-it out or otherwise indicate to the user that this item is not a... Help with JList and JComboBox - comp.lang.java.guiCalling swing gurus, I have a requirement to implement a sublist to a JList. What I've come up with is implement ListCellRenderer and extend JPanel, ... Set JComboBox 's JTextField into JFormattedTextField, how? - comp ...Dear all, Any example to follow for the question I post. I wish to replace the JTextField of JComboBox by JFormattedTextField. Thank you. ... please help me in creating a form using Swing. - comp.lang.java ...I am creating a form using swing through coding (not using netbeans). Now in the form I have one JComboBox of Country and other of State. Now I want ... Using JComboBoxes in a JTable - comp.lang.java.guiIn this solution I can interact with the JComboBoxes but the problem is that when I select a value from one JComboBox, then the JComboBoxes that I have not interacted ... JComboBox (Java 2 Platform SE v1.4.2)public class JComboBox extends JComponent implements ItemSelectable, ListDataListener, ActionListener, Accessible. A component that combines a button or editable ... JComboBox (Java 2 Platform SE 5.0)public class JComboBox extends JComponent implements ItemSelectable, ListDataListener, ActionListener, Accessible. A component that combines a button or editable ... 7/25/2012 7:25:06 PM
|
|
|
|
|
|
|
|
|