public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "abalkiss at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
Date: Wed, 26 Oct 2005 15:23:00 -0000	[thread overview]
Message-ID: <20051026152357.22868.qmail@sourceware.org> (raw)
In-Reply-To: <bug-17360-8730@http.gcc.gnu.org/bugzilla/>



------- 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	other threads:[~2005-10-26 15:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-17360-8730@http.gcc.gnu.org/bugzilla/>
2005-10-26 15:23 ` abalkiss at redhat dot com [this message]
2005-10-26 17:00 ` abalkiss at redhat dot com
2005-10-26 19:15 ` abalkiss at redhat dot com
2005-10-26 19:15 ` abalkiss at redhat dot com
2004-09-08 21:26 [Bug SWING/17360] New: " rodimina at redhat dot com
2004-09-08 21:28 ` [Bug SWING/17360] " rodimina at redhat dot com
2004-10-12  4:13 ` pinskia at gcc dot gnu dot org
2005-06-20 19:19 ` abalkiss at redhat dot com
2005-08-21 16:13 ` [Bug swing/17360] " fitzsim at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051026152357.22868.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).