From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23009 invoked by alias); 26 Oct 2005 15:23:59 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 22869 invoked by uid 48); 26 Oct 2005 15:23:57 -0000 Date: Wed, 26 Oct 2005 15:23:00 -0000 Message-ID: <20051026152357.22868.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: java-prs@gcc.gnu.org From: "abalkiss at redhat dot com" X-SW-Source: 2005-q4/txt/msg00218.txt.bz2 List-Id: ------- 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