Weird SpringLayout Behavior  
Author Message
Matthias Kaeppler





PostPosted: 2005-5-9 1:39:00 Top

java-programmer, Weird SpringLayout Behavior Hi,

I want to place a text field below a slider component using SpringLayout.
I thought it would be most intuitive to use its top-left corner
(north-west corner) to specify its position. However, if I specify its
relative y-position using SpringLayout.NORTH, the edit field gets
resized and expands over the whole pane.
If however I use the SOUTH specifier and therefor specify where its
lower left corner will be, everything works fine!

How come?

code:

// layout EB text field
layout.putConstraint( SpringLayout.WEST, numEBField,
5,
SpringLayout.EAST, numEBLabel );
layout.putConstraint( SpringLayout.SOUTH, numEBField,
25,
SpringLayout.SOUTH, itemsSlider );

The problem is that I have to include the height of the text field in my
positioning data if I do it this way, which is not a good thing IMO.

--
Matthias Kaeppler