Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

I'm developing some little app in JAVA which need to run both on windows and mac os. Just to be a little fancy because is small app i like to change the full GUI depending which windows detects my app.

I'm using this function for windows:

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

Because I'm developing the app on windows when I run the app the look is changed as windows form, but I'm not sure if this will work if put this one for mac(I can't test it on windows this look):

UIManager.setLookAndFeel("com.sun.java.swing.plaf.mac.MacLookAndFeel");

Please tell me if the Mac Os will recognize this one and change the look or need plus something to put in my code.

Thanks, Cheers
Posted
Comments
Richard MacCutchan 12-Sep-13 3:52am    
I have run a similar piece of code using all the different look types, which worked fine on Windows, UNIX and Linux. I would presume it will do the same on MAC, but the only way to be sure is to test it.
Shubhashish_Mandal 12-Sep-13 3:58am    
If you mention nothing about l&f then your app take the system default l&f.
So in your case no need to mention any l&f left it to the system to select the default one .

We set l&f to change the default system l&f to custom l&f.

1 solution

What you want is the SystemLookAndFeel. It will display the GUI according to the environment.

Java
try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
    // Do something.
}


If you want some more info on the look-and-feels, have a look at this: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900