FlatLaf look-and-feel with better Dark mode support. (#23)

This PR configures Symon to use the FlatLaf Swing look-and-feel, giving both a slightly more modern look but also much better support for Dark/Light UI modes. Additional small tweaks to make the UI more readable in both Dark/Light modes.

Detection of system theme also added, selecting the Dark/Light FlatLaf variant accordingly.

Gets rid of need for the hardcoded Metal UI for text fields in StatusPanel workaround as well, as FlatLaf renders these small fields correctly.

Reviewed-on: https://codeberg.org/sethm/symon/pulls/23
Reviewed-by: Seth Morabito <sethm@noreply.codeberg.org>
This commit is contained in:
Retrograde authored and Seth Morabito committed 2026-06-24 23:13:23 +02:00
1 parent 2e2163fefb
commit 45c8a69d7b
15 files changed
+170 -45

No files matched your search

+9 -23
View File
@@ -25,14 +25,15 @@
package com.loomcom.symon;
import com.loomcom.symon.machines.*;
import com.loomcom.symon.ui.Ui;
import org.apache.commons.cli.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Locale;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class Main {
private final static Logger logger = LoggerFactory.getLogger(Main.class.getName());
@@ -58,6 +59,7 @@ public class Main {
CommandLineParser parser = new DefaultParser();
try {
CommandLine line = parser.parse(options, args);
InstructionTable.CpuBehavior cpuBehavior = null;
String romFile = null;
@@ -116,27 +118,11 @@ public class Main {
haltOnBreak = true;
}
Ui.initUi();
while (true) {
if (machineClass == null) {
Object[] possibilities = { "Symon", "Multicomp", "Simple", "BenEater" };
String s = (String) JOptionPane.showInputDialog(
null,
"Please choose the machine type to be emulated:",
"Machine selection",
JOptionPane.PLAIN_MESSAGE,
null,
possibilities,
"Symon");
if (s != null && s.equals("Multicomp")) {
machineClass = MulticompMachine.class;
} else if (s != null && s.equals("Simple")) {
machineClass = SimpleMachine.class;
} else if (s != null && s.equals("BenEater")) {
machineClass = BenEaterMachine.class;
} else {
machineClass = SymonMachine.class;
}
machineClass = Ui.showMachineSelectionDialog();
}
if (cpuBehavior == null) {
@@ -146,9 +132,8 @@ public class Main {
final Simulator simulator = new Simulator(machineClass, cpuBehavior, romFile, haltOnBreak);
SwingUtilities.invokeLater(() -> {
// Create the main UI window:
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// Create the main UI window
simulator.createAndShowUi();
} catch (Exception e) {
logger.error("Error during Symon UI initialization: {}", e.getMessage());
@@ -168,4 +153,5 @@ public class Main {
logger.error("Could not start Symon. Reason: {}", ex.getMessage());
}
}
}