devxlogo

First Visible List Row

First Visible List Row

Question:
Is there a way to find out the first visible row in a List?

Answer:
The standard AWT java.awt.List class does not provide a means for determining the first visible row in a list. However, the Swing package, which is now standard in Java 1.2, provides this functionality in javax.swing.JList. To determine theindex of the first visible row in a JList, simply call getFirstVisibleIndex(). You can also determine the last visible row by invoking getLastVisibleIndex(). You willgenerally find that the Swing classes provide you with greater functionality and flexibility than the core AWT package.

devx-admin

Share the Post: