Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI looks different on Windows and Linux as compared to Mac

 
Jiss Elizabeth
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i developed a GUI on my Mac using Netbeans Mattisse. It looks fine on Mac where as when i try to run the application on Windows or even on Linux the look and feel is completely different. The font looks different, the color looks different, the borders look different and is a kind of really bad when compared to the look and feel on Mac. I have added the same libraries as on Mac. Am wondering what else am missing???

Please do help me regarding this!

Thanks in advance....
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How the GUI looks is determined by the look&feel. By default, Windows and Linux use a cross platform look&feel, but they can switch the look&feel to a system look&feel. That way, it can look like a Windows application in Windows and like a Linux (or at least GTK) application in Linux.

The Mac look&feel is an Apple proprietary look&feel which cannot be ported to Windows or Linux, legally speaking. Perhaps you can do a search on Google to find an attempt by someone to copy it, but that's as far as you're going to get.

But, if you don't like the default look&feel, try a different one available. See http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html. You can get all available look&feels like this:
With an instance of UIManager.LookAndFeelInfo you can set that look&feel:
 
Jiss Elizabeth
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob, but does this mean that i need to create a GUI for Windows/Linux all over again?
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you used a good layout manager, the GUI should still look more or less the same - at least as far as the layout goes.
If you haven't, and you've used setBounds() for all your components, then yes, you're screwed. Every component that has a different size on Windows / Linux will mess up your entire GUI layout.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jiss Varghese wrote:i developed a GUI on my Mac using Netbeans Mattisse...


I think that this is the key problem. Use decent layouts (per the Sun layout manager tutorial) and avoid creating GUIs with Mattisse, and you'll probably find your apps look much better on different systems.
 
salvin francis
Bartender
Posts: 1274
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Screenshots please ???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic