bug-classpath
[Top][All Lists]
Advanced

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

[Bug swing/17360] JScrollPane has incorrect size when JList with specifi


From: abalkiss at redhat dot com
Subject: [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
Date: 26 Oct 2005 15:23:56 -0000


------- Comment #4 from abalkiss at redhat dot com  2005-10-26 15:23 -------
This appears to be a problem with JScrollPane.getPreferredSize(), as the
FlowLayout sets the size of the JScrollPane to its preferredSize, and then this
is a bound for the layout in ScrollPaneLayout which then sets an inappropriate
size for the JViewport.

The simple testcase below shows that JScrollPane is returning an inappropriate
value for getPreferredSize.


***TESTCASE***
import java.awt.*;
import javax.swing.*;

class Test2
{
  public static void main(String[] args)
  {
    JFrame f = new JFrame();
    String[] items = 
                     {
                       "Item1", "Item2", "Item3", "Item4", "Item5", "Item6",
                       "Item7", "Item8", "Item9", "Item10", "Item11"
                     };

    JList list = new JList(items);
    list.setPreferredSize(new Dimension(150, 150));
    f.setLayout(new FlowLayout());
    JScrollPane scroller = new JScrollPane(list);
    System.out.println ("scroll pane pref size: "+scroller.getPreferredSize());
  }


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17360





reply via email to

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