Search code examples
javaswinglook-and-feel

Java Removing Look and Feel


How can I remove any look and feel on my JFrame application to make the controls look like default windows controls ?

Screenshot of what I'm looking for


Solution

  • You can specify the look and feel you want to use. I personally prefer to default to the "system" look and feel, which defaults to the OS specific implementation (Windows on Windows)

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                ex.printStackTrace();
            }
        }
    }
    

    Do this BEFORE you load any other UI elements

    You should also have a look at How to Set the Look and Feel for more details