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 Answer
JList.ensureIndexIsVisible(int index)
6 Comments
user696266
No its a normal JList..im reseting it using the method Setselectionindex(0).
user696266
No its a normal JList. Im reseting using the method setselectionindex(0)
user696266
The Jlist is getting Reset but the scrollbar is not.
MeBigFatGuy
did you even try what i said? That fixes your problem.
user696266
Yup i tried it. that didn do it actually. the solution was to resert the scrollpane also. scrollpane.getVerticalScrollBar().setValue(0);
|
ListModel? How are you clearing it?