Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the windows native look in Java GUI programming?

I am new to Java programming and want to whether it is possible to get the windows native look in Java GUI applications. Obviously Swing won't work.

like image 888
Anirudh Rayabharam Avatar asked Jul 11 '12 03:07

Anirudh Rayabharam


People also ask

How do I set Java look and feel?

To programmatically specify a L&F, use the UIManager. setLookAndFeel() method with the fully qualified name of the appropriate subclass of LookAndFeel as its argument.


2 Answers

Use the following:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 

Read UIManager and How to Set the Look and Feel for more information.

like image 106
tenorsax Avatar answered Sep 16 '22 14:09

tenorsax


Try this....

The syntax is:

UIManager.setLookAndFeel(PLAF); (Pluggable Look and Feel)

So, you must include the below 3 lines.

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

SwingUtilities.updateComponentTreeUI(frame) is used for refreshing the frame after the change.

like image 33
Kumar Vivek Mitra Avatar answered Sep 16 '22 14:09

Kumar Vivek Mitra