Java eclipse WindowBuilder, change look and feel

后端 未结 5 1419
难免孤独
难免孤独 2020-12-10 15:17

im coding a program using windowbuilder in eclipse. I would like to have help with changing the design (Look and feel) from metal to windows. How would i do that? thank you<

5条回答
  •  不知归路
    2020-12-10 15:37

    I had tried setting WIndow Builder to use the system look and feel in preferences, but it still did not work, but simgineer's solution did. I would add to simgineer's post the specific place to add the code, as well as the tags you should use to hide the code from the Window Builder parser. In you main application window...

    public static void main(String[] args) {                
        // hide>>$
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch(Exception e) {
            System.out.println("Error setting native LAF: " + e);
        }
        // $hide<<$
    
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                // generated code ...
            }
        });
    }
    

    Cheers

提交回复
热议问题