Results 1 to 3 of 3
- 01-16-2011, 03:18 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 7
- Rep Power
- 0
Removing values from an array in a list.
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
- 01-16-2011, 05:49 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Add a MouseListener (see How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)) and display a JPopupMenu that displays actions you wish to take.
- 01-17-2011, 07:00 AM #3
Cross posted
Working on a JList and giving it more options? (Swing / AWT / SWT / JFace forum at JavaRanch)
Any more?
db
Similar Threads
-
Need Help in Removing Objects from list
By pramod_r20 in forum New To JavaReplies: 2Last Post: 12-10-2010, 12:19 PM -
Removing the double values?
By Lund01 in forum Advanced JavaReplies: 13Last Post: 11-17-2010, 11:34 AM -
need help with removing repetitions from linked list...
By OptimusPrime in forum New To JavaReplies: 8Last Post: 03-09-2010, 08:29 PM -
How do I list values of an arrays in a comma seperted list
By nmvictor in forum New To JavaReplies: 2Last Post: 11-22-2009, 05:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks