use system look and feel

This commit is contained in:
bea
2026-09-29 12:02:53 +02:00
parent 4ea3c00916
commit f1b4e65998
@@ -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 {