• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scrollable JList

 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to write a method requestScroll for a scrollable JList with the method signature

public void RequestScroll(integer line, integer scrollPolicy)

The RequestScroll method scrolls an item to a specified position in the scroll list display area, moving other items into and out of the display area as necessary.

The line parameter specifies the item to scroll.

The scrollPolicy parameter specifies the position to which to scroll the item. It uses the following values:

ValueDefinition
AF_AUTOMATICIf item is above display area, scrolls to first scroll list display line. If line is beneath display area, scrolls to last scroll list display line. No scrolling occurs if item is already in display area.
AF_BOTTOMScrolls row to bottom scroll list display line.
AF_DEFAULTIf item is above display area, scrolls item to top scroll list display line. If item is beneath display area, scrolls to bottom scroll list display line. No scrolling occurs if item is already in display area.
AF_MIDDLEScrolls item to middle scroll list display line.
AF_TOPScrolls item to top scroll list display line.

How do I implement this in a JList??
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
scrollpane.getViewport().scrollRectToVisible(...);
or
scrollbar.setValue(scrollbar.getMaximum()/whatever);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!