Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6274267
Votes 0
Synopsis ScrollPaneLayout sometimes improperly calculates preferred layout size
Category java:classes_swing
Reported Against b09
Release Fixed 7(b20)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6612531
Submit Date 22-MAY-2005
Description
bustos 2005-05-22

If a horizontal JSplitPane has a tall component on the left and a short, non-scroll-
savvy component in a JScrollPane on the right, with scrollbar policies set to
_AS_NEEDED, then the JSplitPane will lay the left component out at its minimum width
instead of at its preferred width.

The attached ScrollPaneBug.java demonstrates this.

  xxxxx@xxxxx   2005-05-22 23:37:59 GMT
ScrollPaneLayout sometimes improperly calculates preferred layout size. A case is described above.
Posted Date : 2007-06-28 16:10:40.0
Work Around
There is no any workaround.
Evaluation
Not a regression in 5.0. Reproducible in 1.4.0.
  xxxxx@xxxxx   2005-07-21 19:30:37 GMT
Posted Date : 2005-07-21 19:30:37.0

The cause is perfectly described in the comments section (thanks to   xxxxx@xxxxx  ).
Briefly the cause is in the javax.swing.ScrollPaneLayout:preferredLayoutSize() method.
Look at the following code:
...
492    if (viewport !=  null) {
493        extentSize = viewport.getPreferredSize();
494        viewSize = viewport.getViewSize();
495        view = viewport.getView();
496    }
...

For the preferred viewSize calculation the viewport.getViewSize() method is used. However the method can return not only preferred size. If the view size has been set, getViewSize() returns the view size, not the preferred size. It is the cause.

To overcome the problem the view.getPreferredSize() method should be used instead of the viewport.getViewSize() to obtain the view preferred size.
Posted Date : 2007-06-28 16:10:41.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang