Results 1 to 4 of 4
  1. #1
    glhansen is offline Member
    Join Date
    Mar 2009
    Posts
    20
    Rep Power
    0

    Default How to use a JList?

    I have books that don't mention it, sample code that doesn't compile, and more sample code that does fancy tricks but not illustrate the basics.

    Maybe I'm dumb, but the one thing I can't seem to figure out is how to just double click on something in a JList and make it do something. I have a list that is created and added to a window in response to user input, and I can't get anything out of it.

    Can anyone provide beginning-to-end sample code to do that, or point to a good tutorial? I would appreciate it.

  2. #2
    Poincare is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    Did you look it up in the documentation?
    Last edited by Poincare; 03-24-2009 at 02:11 AM.

  3. #3
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    getSelectedIndex()
    Returns the smallest selected cell index; the selection when only a single item is selected in the list.

    add mouselistener to detect double click

  4. #4
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    448
    Rep Power
    6

    Default

    Is it the right place for your thread JList?
    Absolutely Not.
    If You post this ques under Swing category ,you can get plenty response.
    Mak
    (Living @ Virtual World)

Similar Threads

  1. JList and JPanels
    By JetsYanks in forum New To Java
    Replies: 8
    Last Post: 12-25-2009, 02:11 PM
  2. JList issues
    By aneesahamedaa in forum AWT / Swing
    Replies: 7
    Last Post: 12-15-2009, 04:16 PM
  3. JList
    By pinks_70986 in forum New To Java
    Replies: 1
    Last Post: 02-12-2009, 08:36 AM
  4. About JList
    By hungleon88 in forum Advanced Java
    Replies: 5
    Last Post: 08-30-2008, 09:24 PM
  5. Help with JList
    By Albert in forum NetBeans
    Replies: 1
    Last Post: 07-13-2007, 03:42 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
  •