classpath-patches
[Top][All Lists]
Advanced

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

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


From: Anthony Balkissoon
Subject: Re: [cp-patches] Patch for Approval: JList getFirstVisibleIndex and getLastVisibleIndex
Date: Thu, 04 Aug 2005 10:56:19 -0400

This is committed.

On Tue, 2005-08-02 at 16:25 -0400, Anthony Balkissoon wrote:
> This patch fixes an off-by-one-pixel problem in getFirstVisibleIndex and
> getLastVisibleIndex.
> 
> 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/JList.java:
> (getFirstVisibleIndex): Translate visible rectangle by one less pixel.
> (getLastVisibleIndex): Likewise.
> 
> 
> ===TEST CASE ===
> import java.awt.*;
> import javax.swing.*;
> import java.io.*;
> 
> class Test
> {
>   public static void main(String[] args) throws IOException
>   {
>     JFrame f = new JFrame();
>     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>     String[] items = 
>                      {
>                        "Item1", "Item2", "Item3", "Item4", "Item5",
> "Item6",
>                        "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();
>     scroller.getViewport().setView(list);
> 
>     f.getContentPane().add(scroller);
>     f.setSize(100, 200);
> 
>     f.show();
>   }
> }
> 
> -Tony
> _______________________________________________
> Classpath-patches mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/classpath-patches





reply via email to

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