From f1b4e659988455408eb2d9fb91bb36dec029b019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Tue, 29 Sep 2026 12:02:53 +0200 Subject: [PATCH] use system look and feel --- src/main/java/wtf/beatrice/autosqueal/Main.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/wtf/beatrice/autosqueal/Main.java b/src/main/java/wtf/beatrice/autosqueal/Main.java index 5c20845..b5087e0 100644 --- a/src/main/java/wtf/beatrice/autosqueal/Main.java +++ b/src/main/java/wtf/beatrice/autosqueal/Main.java @@ -8,6 +8,7 @@ import wtf.beatrice.autosqueal.listener.KeyPressListener; import wtf.beatrice.autosqueal.ui.MainWindow; import javax.swing.*; +import javax.swing.UnsupportedLookAndFeelException; public class Main { @@ -17,12 +18,21 @@ public class Main { public static void main(String[] args) { LOGGER.info("Hello world!"); + useSystemLookAndFeel(); registerJNativeHook(); // all Swing components must be created and updated on the EDT SwingUtilities.invokeLater(mainWindow::init); } + private static void useSystemLookAndFeel() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ReflectiveOperationException | UnsupportedLookAndFeelException ex) { + LOGGER.warn("Could not set the system look and feel, using the default one", ex); + } + } + private static void registerJNativeHook() { LOGGER.info("Registering jnativehook library..."); try {