Skip to content

Commit 96e4122

Browse files
Load custom L&F from theme
1 parent 15089f0 commit 96e4122

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

app/src/processing/app/Base.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,6 @@ public Base(String[] args) throws Exception {
250250
Theme.init();
251251
System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));
252252

253-
// Set the look and feel before opening the window
254-
try {
255-
BaseNoGui.getPlatform().setLookAndFeel();
256-
} catch (Exception e) {
257-
// ignore
258-
}
259-
260253
// Use native popups so they don't look so crappy on osx
261254
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
262255
} else {

app/src/processing/app/Theme.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.util.zip.ZipEntry;
5858
import java.util.zip.ZipFile;
5959

60+
import javax.swing.UIManager;
6061
import javax.swing.text.StyleContext;
6162

6263
import org.apache.batik.transcoder.Transcoder;
@@ -344,6 +345,28 @@ static protected void init() {
344345

345346
// clone the hash table
346347
defaults = new PreferencesMap(table);
348+
349+
// Set the look and feel before opening the window
350+
try {
351+
String laf = defaults.get("ui.laf");
352+
353+
if(laf != null && ! laf.trim().isEmpty()) {
354+
355+
try {
356+
UIManager.setLookAndFeel(laf);
357+
} catch (Exception e) {
358+
e.printStackTrace();
359+
BaseNoGui.getPlatform().setLookAndFeel();
360+
}
361+
362+
}else {
363+
BaseNoGui.getPlatform().setLookAndFeel();
364+
}
365+
366+
} catch (Exception e) {
367+
// ignore
368+
}
369+
347370
}
348371

349372
static private ZippedTheme openZipTheme() {

0 commit comments

Comments
 (0)