Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why does the GUI created using Swing look different on different platforms?  RSS feed

 
Judy YU
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a GUI applet using Java Swing and using the MotifLookAndFeel. The applet looks great on Solaris 8 platform,
but the size of TextArea changes on Windows which ruins the look of the GUI.
Can anyone give a clue about what might cause the problem?
Judy
 
John Zukowski
Author
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Layout management issues probably.
------------------
John Zukowski Author of "Definitive Guide to Swing for Java 2" and "Java Collections"
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default look and feel for Swing - Metal - would look the same across *all* platforms. Am I correct on this?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Judy,
IMOP it could be that you are not specifying a font. JVM only specifies that font types be available and not that all sizes be the same on all platforms (e.g. 12 on Unix <> 12 on PC).
As stated by John, you usually use a layout manager to make sure your objects don't move. From your explanation, I gather you probably are using a null layout... GridBagLayout gives the programmer the most control over how extra space is used and what happens when things are resized.
Regards,
Manfred.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!