[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch for Approval: JList getFirstVisibleIndex and getLastV

From: Anthony Balkissoon
Subject: [cp-patches] Patch for Approval: JList getFirstVisibleIndex and getLastVisibleIndex
Date: Tue, 02 Aug 2005 16:25:16 -0400

This patch fixes an off-by-one-pixel problem in getFirstVisibleIndex and

I discovered this problem running the simple test case at the bottom of
this email and using the PAGE DOWN key.  Without this patch, 1 pixel of
a list item is showing at the bottom and thus page down does nothing
more than the down arrow key.

Patch attached.

2005-08-02  Anthony Balkissoon  <address@hidden>

* javax/swing/
(getFirstVisibleIndex): Translate visible rectangle by one less pixel.
(getLastVisibleIndex): Likewise.

===TEST CASE ===
import java.awt.*;
import javax.swing.*;

class Test
  public static void main(String[] args) throws IOException
    JFrame f = new JFrame();
    String[] items = 
                       "Item1", "Item2", "Item3", "Item4", "Item5",
                       "Item7", "Item8", "Item9", "Item10", "Item11",
"Item12", "Item13",
                       "Item14", "Item15", "Item16", "Item17", "Item18"
    JList list = new JList(items);
    list.setPreferredSize(new Dimension(150, 150));

    JScrollPane scroller = new JScrollPane();

    f.setSize(100, 200);;


Attachment: JListGetFirstLastVisibleFix.diff
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]