2

In a JList with a scrollpane. I have assigned a default selection value. On click of a reset button I'm assigning the default value. It works fine for when there are less values. But when there are many values when I press reset the default value gets selected, but is not focused. I remain at the end of the scrollbar and not at the beginning where the scrollbar begins because the default value is the first value. Can anyone please help me with this.

1
  • What ListModel? How are you clearing it? Commented May 3, 2011 at 4:10

1 Answer 1

1
JList.ensureIndexIsVisible(int index)
Sign up to request clarification or add additional context in comments.

6 Comments

No its a normal JList..im reseting it using the method Setselectionindex(0).
No its a normal JList. Im reseting using the method setselectionindex(0)
The Jlist is getting Reset but the scrollbar is not.
did you even try what i said? That fixes your problem.
Yup i tried it. that didn do it actually. the solution was to resert the scrollpane also. scrollpane.getVerticalScrollBar().setValue(0);
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.