File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Working on a JList and giving it more options? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Working on a JList and giving it more options?" Watch "Working on a JList and giving it more options?" New topic
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: 2200
    
    7
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: 4638
    
    5

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: 4638
    
    5

And even more important, BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/awt-swing/37425-removing-values-array-list.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Working on a JList and giving it more options?