Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Proper initial component layout with SpringLayout

0 views
Skip to first unread message

Eric C. Welton

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

I've been poking around with the struts and springs layout manager
and am having a damnable time trying to figure out
what the 'right' way to do component layout is - now I should state
that I am used to the X/Xm style attachments and tend to feel all
dirty inside if I explicitly refer to the dimensions of the display
area - however, if I take the SwingSet example code as any sort of
a guide it seems as if one must explicitly hard code the preferred
dimensions of the components during gui construction and then let
the manager chuck them all away by forcing an application resize.
This seems silly and I suspect that it reflects a misunderstanding
on my part - the alternative which seems closest to an elegant solution
would be to base all size calculations on the current application size,
which I presume would make use of the addNotify() chain? But this
also seems silly - since one is constantly having to get one's current
dimensions, subtract away border components, create a normalized
frame of reference and basically perform all of the geometry management
that a layout manager is supposed to handle for you just to place
your components in the correct initial positions so that the springs
and struts act as desired - as I said, this seems rather silly - but
for lack of documentation and/or examples save those
in the swing release I was wondering if anyone might be able to suggest
some good information about the 'proper' way to perform initial
component layout using the SpringLayout manager?

eric


Eric C. Welton

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

Eric C. Welton

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

John Goodsen

unread,
Nov 11, 1997, 3:00:00 AM11/11/97
to

I am also used to many layout managers, including the XmForm,
and the Galaxy springs/struts layout manager.

What Swing is missing is the ability to specify struts between
components as well as the container:

- Struts should be explicitly definable with a distance value,
similar to struts in the Box class.

- I'd like to specify a "spring-strut" which has a minimum
strut distance with spring behavior beyound the strut.

- Need some way to expand a component to take up all of the
area in a dimension (x or y), while respecting the springs/struts
of other components. It kinda does it now - *AFTER* you specify
a Bounds for the component. What I want is to do this without
ever specifying the Bounds for the component.

- Need to attach springs/struts between components in the container,
as well as to the container itself.

IMHO, the SpringLayout manager should be replaced with a real
SpringStrut layout manager as in Galaxy. Another thing cool about
the Galaxy SprintStrut manager was that it was solvable in constant
time, making it feasible to "watch" the components layout as you
move them around, stretch the dialog, etc inside the GUI builder
(as opposed to a move/stretch and then watch the constraints get
resolved like the XmForm does...)

Maybe we're justing using SpringLayout wrong? Anyone from the
Swing team following this and have some answers?

--
John Goodsen Saguaro Software, Inc. / Training & Consulting
in:
jgoo...@saguarosoft.com - User Centered Analysis and Architecture
http://www.saguarosoft.com - User Centered Object-Oriented Design
602.706.1056 - Rapid Incremental Delivery Software
Process

0 new messages