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: 4172932
Votes 7
Synopsis BorderLayout provides no way to get the constraint for each child
Category java:classes_awt
Reported Against 1.3.1 , 1.2rc1 , 1.2beta4
Release Fixed 1.5(tiger)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs 4203039 , 4908732
Submit Date 11-SEP-1998
Description




We are building a SwingSet IDE. Among other things
the visual editor must allow a user to edit the
LayoutManager that is attached to a JPanel.
The BorderLayout's API provides no way to find the
constraint associated with each child ("North",
"South", "East", etc.).

GridBagLayout already has such a thing:
(getConstaints).

Without this ability the BorderLayout is clumsy and
confusing when used in conjunction with an IDE
supporting a visual editor, since if the user
wants to edit a Component's contraint we
can't display the current value.

Adding a new methods called getConstraint(Component)
which returned a String would solve this problem.
(Review ID: 38184)
======================================================================




java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

It's currently not possible to tell how a given component is constrained
in a BorderLayout, or what component is at a specific constraint.  There
are cases where this information is crucial. For example, restoring the
current location of a tool palette in a BorderLayout requires being able
to tell that the user dragged the palette to another position, and then
to save the new constraint.  This information is locked up in the layout,
and there doesn't seem to be a practical way to recover it.
(Review ID: 127797)
======================================================================
Work Around
N/A
Evaluation
Sounds reasonable.
 xxxxx@xxxxx  2000-01-03


Adding three methods to BorderLayout, one to get the constraints for a
component, and two slightly different ways to get the component for
a given constraint (taking component orientation into account or not).

 xxxxx@xxxxx  2003-07-17
Comments
  
  Include a link with my name & email   

Submitted On 01-DEC-1998
kilrath
You also need to add a setter (setConstraint).
I also reported this but it mysteriously never made
it in here, yet my other bugs did... hmmmm.
Anyway - the other solution is to make the
class vars for the constraints public (they are
currently protected). Not as optimal as the above
solution request, but takes only 30 seconds if
you are *that* pressed for time.
*Please* fix this... and also make ALL the layouts
Bean compliant.
Thank you.


Submitted On 22-MAY-2003
ghamer
Please consider adding getConstraint and setConstraint (as
in GridBagLayout) to an interface LayoutManager3 that 
extends LayoutManager2 so that builder tools can manipulate 
constraints without having to remove and re-add the 
component. Then go back and make all the existing sun 
layout managers that use constraints implement 
LayoutManager3.



PLEASE NOTE: JDK6 is formerly known as Project Mustang