| Author |
Working on a JList and giving it more options?
|
Ben Jass
Ranch Hand
Joined: Sep 25, 2010
Posts: 76
|
|
Hey guys, this is my situation, I have a program that you can input arrays into it. When you input these arrays into a JTextField, it takes the values, puts them in numeric order, and puts in them in a JList.
I'm not very experienced with swing, is there a way I can make it so that if I right click one of the selections inside the array I can give it an option to delete it from the array?
I know how to delete things from an array and all that, I'm just curious how to get my mouse involved so that if I right click on a selection it brings up a drop down menu or something, you know like if you randomly click on your screen, but this one gives you an option to "Delete this value"?
Thanks
~ Benny
|
 |
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1791
|
|
|
Read the JLIst API and follow the link to the section in the Swing tutorial on "How to Use Lists" for a working example that allows you to add/remove items from a JList.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
|
Also the JPopupMenu API, which has a link to the tutorial on How to Use Menus.
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
And even more important, BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/awt-swing/37425-removing-values-array-list.html
|
 |
 |
|
|
subject: Working on a JList and giving it more options?
|
|
|