Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes GUI looks different on Windows and Linux as compared to Mac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GUI looks different on Windows and Linux as compared to Mac" Watch "GUI looks different on Windows and Linux as compared to Mac" New topic
Author

GUI looks different on Windows and Linux as compared to Mac

Jiss Elizabeth
Greenhorn

Joined: Jul 28, 2004
Posts: 19
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

Joined: Oct 27, 2005
Posts: 19783
    
  20

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:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jiss Elizabeth
Greenhorn

Joined: Jul 28, 2004
Posts: 19
Thanks Rob, but does this mean that i need to create a GUI for Windows/Linux all over again?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

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

Joined: Feb 23, 2007
Posts: 1561
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
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

Screenshots please ???


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
Consider Paul's rocket mass heater.
 
subject: GUI looks different on Windows and Linux as compared to Mac