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.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist