Results 1 to 3 of 3
  1. #1
    BennyJass is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default 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"?

    ~ Benny

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Rep Power


    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.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

Similar Threads

  1. Need Help in Removing Objects from list
    By pramod_r20 in forum New To Java
    Replies: 2
    Last Post: 12-10-2010, 12:19 PM
  2. Removing the double values?
    By Lund01 in forum Advanced Java
    Replies: 13
    Last Post: 11-17-2010, 11:34 AM
  3. need help with removing repetitions from linked list...
    By OptimusPrime in forum New To Java
    Replies: 8
    Last Post: 03-09-2010, 08:29 PM
  4. Replies: 2
    Last Post: 11-22-2009, 05:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts