• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scrollpane doubt  RSS feed

 
Smriti Anchu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a list box in a JScrollPane. I want the scrollpane's vertical scrollbar to move to the last item in the list box whenever an item is added to the listbox dynamically.

I have written the following code



But the vertical scroll bar is always set at a position 1 item above the newly added item. I want the scrollbar to be set at the last position so that the newly added item is visible
How do i do this

Do reply me

regards
smriti
 
Smriti Anchu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I got the solution.
Use ensureIndexIsVisible(selectindex) method on the listbox once a data is entered.

eg:


Now the newly added data in the listbox is visible

bye
smriti
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!