JList Problems

Discussion in 'Java' started by Tom, Jul 30, 2003.

  1. Tom

    Tom Guest

    Hi,

    I have a JList with some String values in it and i have a ScrollPane tied
    to the JList. Now the problem. When you have made a selection from the JList
    i want to set my JList to the start value again but i cant get it to work.
    I've tried with the JList methods: setSelectedIndex(int index), clearSelection(),
    but nothing happends. So no i wonder how to set my JList to show the index
    value i want?

    Best Regards
    Tom
    Tom, Jul 30, 2003
    #1
    1. Advertising

  2. Tom

    Dave Roberts Guest

    Tom wrote:
    > Hi,
    >
    > I have a JList with some String values in it and i have a ScrollPane tied
    > to the JList. Now the problem. When you have made a selection from the JList
    > i want to set my JList to the start value again but i cant get it to work.
    > I've tried with the JList methods: setSelectedIndex(int index), clearSelection(),
    > but nothing happends. So no i wonder how to set my JList to show the index
    > value i want?
    >
    > Best Regards
    > Tom
    >


    Try ensureIndexIsVisible(int index) to set the viewport such that a
    particular item in the list is visible.
    Dave Roberts, Jul 30, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Passero

    JList question

    Passero, Jun 28, 2003, in forum: Java
    Replies:
    1
    Views:
    1,098
    Stephan Friedrichs
    Jun 28, 2003
  2. Sam
    Replies:
    0
    Views:
    884
  3. Tom

    JList problem.

    Tom, Jul 30, 2003, in forum: Java
    Replies:
    1
    Views:
    696
  4. nitesh sood

    problems with JList

    nitesh sood, May 22, 2008, in forum: Java
    Replies:
    0
    Views:
    381
    nitesh sood
    May 22, 2008
  5. Replies:
    8
    Views:
    149
Loading...

Share This Page