use system look and feel
This commit is contained in:
@@ -8,6 +8,7 @@ import wtf.beatrice.autosqueal.listener.KeyPressListener;
|
|||||||
import wtf.beatrice.autosqueal.ui.MainWindow;
|
import wtf.beatrice.autosqueal.ui.MainWindow;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.UnsupportedLookAndFeelException;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@@ -17,12 +18,21 @@ public class Main {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
LOGGER.info("Hello world!");
|
LOGGER.info("Hello world!");
|
||||||
|
|
||||||
|
useSystemLookAndFeel();
|
||||||
registerJNativeHook();
|
registerJNativeHook();
|
||||||
|
|
||||||
// all Swing components must be created and updated on the EDT
|
// all Swing components must be created and updated on the EDT
|
||||||
SwingUtilities.invokeLater(mainWindow::init);
|
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() {
|
private static void registerJNativeHook() {
|
||||||
LOGGER.info("Registering jnativehook library...");
|
LOGGER.info("Registering jnativehook library...");
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user