import javax.swing.UIManager; // Get the current look and feel String lookAndFeel = UIManager.getLookAndFeel().getName(); System.out.println("Current look and feel: " + lookAndFeel);
import javax.swing.*; // Set the look and feel to Windows try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } // Create a JFrame with some components JFrame frame = new JFrame("My Frame"); JButton button = new JButton("Click me!"); JTextField textField = new JTextField("Enter text here"); frame.add(button); frame.add(textField); frame.pack(); frame.setVisible(true);This example sets the look and feel to the system's default look and feel (which for most Windows systems will be the "Windows" look and feel) and then creates a JFrame with a button and a text field. This method belongs to the Java Swing package library.