Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SpringLayout seems unworkable on OSX



Mark,

Are you 100% sure you're using Java 5 on Windows?  Your SpringLayout should be incorrect for any Java 4 or 5 platform.  The reason can be found in Sun bug ID 4726194.  Basically, Java 5's SpringLayout constraints are order-dependent.  So setting WEST then EAST is completely different to setting EAST then WEST.  The reason for this is that each axis actually has three types of constraints: EAST, WEST, WIDTH and NORTH, SOUTH, HEIGHT.  When you set the EAST spring, the WEST spring is automatically adjusted using the WIDTH spring.  When you set the WEST spring, the WIDTH spring is automatically adjusted using the EAST spring, etc.  e.g.  for the horizontal axis the following formula must hold true:  width = east - west 

The basic rule for Java 5 SpringLayout is EAST/SOUTH first, then WEST/NORTH.  I've attached a modified version of your example which works perfectly in all Java versions.  I suspect that on Windows you where using Java 6 without knowing it.

Regards,
Brendon.

Attachment: SpringLayoutTest.java
Description: Binary data



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: SpringLayout seems unworkable on OSX (From: Greg Guerin <email@hidden>)
 >Re: SpringLayout seems unworkable on OSX (From: Mark Leone <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.