public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
       [not found] <bug-17360-8730@http.gcc.gnu.org/bugzilla/>
@ 2005-10-26 15:23 ` abalkiss at redhat dot com
  2005-10-26 17:00 ` abalkiss at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: abalkiss at redhat dot com @ 2005-10-26 15:23 UTC (permalink / raw)
  To: java-prs



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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
       [not found] <bug-17360-8730@http.gcc.gnu.org/bugzilla/>
  2005-10-26 15:23 ` [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it abalkiss at redhat dot com
@ 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
  3 siblings, 0 replies; 8+ messages in thread
From: abalkiss at redhat dot com @ 2005-10-26 17:00 UTC (permalink / raw)
  To: java-prs



------- Comment #5 from abalkiss at redhat dot com  2005-10-26 17:00 -------
An even more specific test case shows that the problem is in ScrollPaneLayout's
preferredLayoutSize method.


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

class Test
{
  public static void main(String[] args)
  {
    String[] items = 
      {
        "Item1", "Item2", "Item3", "Item4", "Item5", "Item6",
        "Item7", "Item8", "Item9", "Item10", "Item11"
      };
    JList list = new JList(items);
    list.setPreferredSize(new Dimension(150, 150));
    JScrollPane scroller = new JScrollPane(list);
    System.out.println (scroller.getLayout().preferredLayoutSize(scroller));
  }
}


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
       [not found] <bug-17360-8730@http.gcc.gnu.org/bugzilla/>
  2005-10-26 15:23 ` [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it abalkiss at redhat dot com
  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
  3 siblings, 0 replies; 8+ messages in thread
From: abalkiss at redhat dot com @ 2005-10-26 19:15 UTC (permalink / raw)
  To: java-prs



------- Comment #6 from abalkiss at redhat dot com  2005-10-26 19:15 -------
Created an attachment (id=10064)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10064&action=view)
patch


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
       [not found] <bug-17360-8730@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-10-26 19:15 ` abalkiss at redhat dot com
@ 2005-10-26 19:15 ` abalkiss at redhat dot com
  3 siblings, 0 replies; 8+ messages in thread
From: abalkiss at redhat dot com @ 2005-10-26 19:15 UTC (permalink / raw)
  To: java-prs



------- Comment #7 from abalkiss at redhat dot com  2005-10-26 19:15 -------
Fixed, patch attached.


-- 

abalkiss at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |0.19


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it
  2004-09-08 21:26 [Bug SWING/17360] New: " rodimina at redhat dot com
                   ` (2 preceding siblings ...)
  2005-06-20 19:19 ` abalkiss at redhat dot com
@ 2005-08-21 16:13 ` fitzsim at redhat dot com
  3 siblings, 0 replies; 8+ messages in thread
From: fitzsim at redhat dot com @ 2005-08-21 16:13 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|graydon at redhat dot com   |abalkiss at redhat dot com
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug SWING/17360] JScrollPane has incorrect size when JList with specified size is added to it
  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
  3 siblings, 0 replies; 8+ messages in thread
From: abalkiss at redhat dot com @ 2005-06-20 19:19 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From abalkiss at redhat dot com  2005-06-20 19:18 -------
Problem may be with layout managers instead of JScrollPane.  Run the test case
from Additional Comment #1 and try changing the JFrame's layout manager to
BoxLayout or GridLayout.  The problem no longer surfaces.

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug SWING/17360] JScrollPane has incorrect size when JList with specified size is added to it
  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
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12  4:13 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-12 04:13 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-12 04:13:30
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug SWING/17360] JScrollPane has incorrect size when JList with specified size is added to it
  2004-09-08 21:26 [Bug SWING/17360] New: " rodimina at redhat dot com
@ 2004-09-08 21:28 ` rodimina at redhat dot com
  2004-10-12  4:13 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: rodimina at redhat dot com @ 2004-09-08 21:28 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From rodimina at redhat dot com  2004-09-08 21:28 -------
Created an attachment (id=7070)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7070&action=view)
Test program illustrating the bug


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-10-26 19:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-17360-8730@http.gcc.gnu.org/bugzilla/>
2005-10-26 15:23 ` [Bug swing/17360] JScrollPane has incorrect size when JList with specified size is added to it abalkiss at redhat dot com
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

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