Add a set of aliases for the system LnF for the major platforms

auto-update
Zlatin Balevsky 2021-10-25 20:46:05 +01:00
parent 5100a4ad44
commit 8392f1af5b
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import com.muwire.gui.LNFs
import griffon.core.GriffonApplication
import groovy.swing.SwingBuilder
import groovy.util.logging.Log
@ -118,6 +119,9 @@ class Initialize extends AbstractLifecycleHandler {
LookAndFeel chosen = lookAndFeel('system', 'gtk', 'metal')
uiSettings.lnf = chosen.getID()
log.info("ended up applying $chosen.name")
if (LNFs.SYSTEM_ALIASES.contains(uiSettings.lnf))
uiSettings.lnf = "system"
FontUIResource defaultFont = chosen.getDefaults().getFont("Label.font")
uiSettings.font = defaultFont.getName()

View File

@ -6,6 +6,7 @@ package com.muwire.gui
class LNFs {
static final Map<String, String> nameToClass = new HashMap<>()
static final Map<String, String> classToName = new HashMap<>()
static final Set<String> SYSTEM_ALIASES = new HashSet<>()
static final String[] availableLNFs
@ -24,6 +25,10 @@ class LNFs {
}
static {
SYSTEM_ALIASES.add("GTK") // Linux
SYSTEM_ALIASES.add("Aqua") // Mac
SYSTEM_ALIASES.add("Windows") // Windows
register("System", "system")
register("Metal","metal")
register("Darcula","com.bulenkov.darcula.DarculaLaf")