Anirudh Rayabharam
Anirudh Rayabharam

Reputation: 747

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.

Upvotes: 50

Views: 73562

Answers (3)

Tan Hao
Tan Hao

Reputation: 39

try this code:

javax.swing.UIManager.setLookAndFeel("Windows")

Upvotes: -5

tenorsax
tenorsax

Reputation: 21223

Use the following:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

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

Upvotes: 93

Kumar Vivek Mitra
Kumar Vivek Mitra

Reputation: 33534

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.

Upvotes: 17

Related Questions