• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scrollable JList

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
scrollpane.getViewport().scrollRectToVisible(...);
or
scrollbar.setValue(scrollbar.getMaximum()/whatever);
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic