Forums Register Login
Swing layout appears different on 2 Computers with Same OS?
I have a swing interface that appears different on two machines running Windows XP. I have a split pane. The right side contains 7 text fields with a button to the right of each. They are layed out with the Box Layout. The fit perfectly fine on one machine. On another, the text fields stretch too much and dont fit inside the right pane. I have the frame set to a fixed width.
Is this a common problem? Any suggestions?
If you're setting a size explicitly you will probably run into problems somewhere...

This is a problem across look & feels because they calculate widget sizes differently. This is a problem across some Java versions because they change the algorithms to calculate size. This is also a problem between different screen resolutions. I'm betting your problem is either a difference in JDK versions or a difference in screen resolutions, but the root cause is that you shouldn't be setting an explicit size. You can use pack() on the top level frame and the frame will be sized according to the preferred size of the components it contains.
Let's get him boys! We'll make him read this tiny ad!
Why should you try IntelliJ IDEA ?

This thread has been viewed 867 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 18, 2018 03:06:38.