Skip to content

Commit 546a716

Browse files
committed
AbstractSwingUI: try creating the console first
If that fails, something is wrong with the L&F, and we should stop.
1 parent 9372f74 commit 546a716

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/org/scijava/ui/swing/AbstractSwingUI.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ protected void createUI() {
249249
// Before we create any UI components, initialize the Look and Feel.
250250
if (lafService != null) lafService.initLookAndFeel();
251251

252+
// NB: Create the console first, because if the Look and Feel
253+
// is busted, it will trigger an infinite loop during console
254+
// initialization, which the SwingConsolePane is smart enough to
255+
// catch and throw a RuntimeException in response, thereby
256+
// avoiding any subsequent output shenanigans past this point.
257+
if (!Boolean.getBoolean(ConsolePane.NO_CONSOLE_PROPERTY)) {
258+
consolePane = new SwingConsolePane(getContext());
259+
}
260+
252261
final JMenuBar menuBar = createMenus();
253262

254263
appFrame = new SwingApplicationFrame(appService.getApp().getTitle());
@@ -257,10 +266,6 @@ protected void createUI() {
257266
toolBar = new SwingToolBar(getContext());
258267
statusBar = new SwingStatusBar(getContext());
259268

260-
if (!Boolean.getBoolean(ConsolePane.NO_CONSOLE_PROPERTY)) {
261-
consolePane = new SwingConsolePane(getContext());
262-
}
263-
264269
systemClipboard = new AWTClipboard();
265270

266271
setupAppFrame();

0 commit comments

Comments
 (0)