开发者

NetBeans: How to change the look and feel with respect to Operating System

开发者 https://www.devze.com 2023-04-09 22:15 出处:网络
I developed a small desktop application in Netbeans using Java. The application is working as expected. I developed it un开发者_C百科der WIN7.

I developed a small desktop application in Netbeans using Java. The application is working as expected. I developed it un开发者_C百科der WIN7.

When i run it on Microsoft Windows, the look and feel of UI is similar to Win XP Metal theme and when i run it on MAC it shows me the same theme. I want to change that theme with respect to operating system. Right now the theme is ok for windows i am looking for solution on MAC.


try{UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}
catch(Exception e){}


If you're using Swing, then this should work:

try {
  UIManager.setLookAndFeel(
    UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}


Read the secton from the Swing tutorial on How to Set the Look and Feel for information about setting/changing the LAF.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号