jList in Scrollpane, seeking and displaying value of selectedIndex
Posted
by Mech Software
on Stack Overflow
See other posts from Stack Overflow
or by Mech Software
Published on 2010-03-28T21:07:27Z
Indexed on
2010/03/28
21:13 UTC
Read the original article
Hit count: 435
I have a JList inside a Scrollpane. If you click on the list and move the arrow keys up and down it works like you expect, you can move your selection index and display around just fine.
Now, what I want to do is basically have a text box and i'm typing in the text box like "comic" and want it to seek to the index of that value. This WORKS just fine.
Where the problem is when the value of the list box is below, or above the viewable area. When it is, the selected index seeks, but does not change the position of the scrollable region. However, if I press the up or down arrows and requestFocus() to the list, and move up and down it seeks to the right viewable area.
What am I missing to make this happen WITHOUT changing focus. I want to be able to just type in the list all I want and have it show me what is selected. I feel i'm missing something obvious here.
© Stack Overflow or respective owner