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

后端 未结 3 1048
别跟我提以往
别跟我提以往 2020-12-07 19:05

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.

相关标签:
3条回答
  • 2020-12-07 19:18

    try this code:

    javax.swing.UIManager.setLookAndFeel("Windows")
    
    0 讨论(0)
  • 2020-12-07 19:26

    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.

    0 讨论(0)
  • 2020-12-07 19:40

    Use the following:

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    

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

    0 讨论(0)
提交回复
热议问题