Im building a GUI in Netbeans, it looks good in the designer but when I run the program it looks pretty rubbish. Im using a Mac and so I feel that it would look better using the Mac OS LAF but then when I run it on Windows, what will happen? Is a Windows system able to use the Mac LAF and vice-versa?
I dont usually mind the Ocean/Metal LAF but it looks better on Windows than it does on Mac, is there a way to set a theme as a fallback? Or to change depending on the system its running on?
The UIManager.setLookAndFeel(String className)
Loads the LookAndFeel
specified by the given class name:className
, using the current thread's context class loader.
To set look and feel of your current system, make use of UIManager.getSystemLookAndFeelClassName()
: Returns the name of the LookAndFeel
class that implements the native system look and feel if there is one, otherwise the name of the default cross platform LookAndFeel
class.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
put this code before you create instance of your application window: JFrame
or any such Top-level Container.