Hi,
I am designing a Popup Menu Item that shall allow the End User to select an
item from an indeterminate length List.
I know how to add each JList element to the JPopupMenu but because the
length of the list is variable I need to implement a Scroll Bar somehow.
Ideally, I would like to add a JList hosted by a JScrollPane to my
JPopupMenu instance.
I found some code on the net that suggest that I build an Inner Class that
extends JList and uses the 'MenuElement' Interface. Actually the sample I
saw extended the JSlider Class.
I got that code past the compiler but the JList shows up funny and I was not
able to assign an Action Event.
Question:
I guess I could just make a new JDialog to contain my JList and place it
over the JPopupMenu but I am wondering if there is a way to implement a
JList as an item in my JPopupMenu instance?
NOTE: JSPinner would be nice in lieu of JList but I am still at Java 1.3.1
and I believe JSpinner is a 1.4.1 Class...
Many thanks,
Jim.
Jim Crowell - 06 Feb 2004 17:15 GMT
Follow Up FYI:
I got a litttle further with the usage of a JList in a Menu Item so I think
it is most likely possible.
However, I implemented my requirement by using JMenuItem's for each List
item and managing
"UP" / "DOWN" Menu Items to scroll the variable length items list.
Regards,
Jim...