JList in Scrollpane, seeking and displaying value of selectedIndex?

If I understand the question then you should be able to use.

Up vote 1 down vote favorite share g+ share fb share tw.

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. Java swing jpanel jlist jscrollpane link|improve this question asked Mar 28 '10 at 21:07Mech Software1,318316 100% accept rate.

If I understand the question then you should be able to use: list. SetSelectedIndex(...); list. EnsureIndexIsVisible(...); If that doesn't help then post your SSCCE demonstrating the problem.

This worked perfectly, just what I was missing. I looked through that API page no less than 10 times and I'm not sure how I missed that method. Thanks again!

– Mech Software Mar 30 '10 at 12:50.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions