This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Swing layout appears different on 2 Computers with Same OS?  RSS feed

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!