try { UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception e) { e.printStackTrace(); }
UIManager.put("Label.font", new FontUIResource(new Font("Arial", Font.PLAIN, 20))); UIManager.put("Button.font", new FontUIResource(new Font("Arial", Font.PLAIN, 20)));In this example, we are using the FontUIResource class from the javax.swing package, which is also part of the Java standard library. Overall, the javax.swing.UIManager class provides a powerful set of tools for customizing the look and feel of a Swing application.