------- 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