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.
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.
Use the following:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Read UIManager and How to Set the Look and Feel for more information.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With