From c9596fd8c4c22311f776701567b771f39e7a38c9 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Mon, 9 Aug 2021 10:02:24 +0100 Subject: [PATCH] Catch exceptions thrown during GUI initialization. This is a workaround for an UnsupportedOperationException thrown when using X2Go, due to PERPIXEL_TRANSLUCENT translucency being unsupported in splashDialog.setBackground(). We could choose to use a different version of the splash screen with an opaque background in these cases, but it is low priority. --- src/main/java/org/qortal/gui/Gui.java | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/qortal/gui/Gui.java b/src/main/java/org/qortal/gui/Gui.java index 118718e2..87342f6a 100644 --- a/src/main/java/org/qortal/gui/Gui.java +++ b/src/main/java/org/qortal/gui/Gui.java @@ -23,17 +23,21 @@ public class Gui { private SysTray sysTray = null; private Gui() { - this.isHeadless = GraphicsEnvironment.isHeadless(); - - if (!this.isHeadless) { - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException - | UnsupportedLookAndFeelException e) { - // Use whatever look-and-feel comes by default then + try { + this.isHeadless = GraphicsEnvironment.isHeadless(); + + if (!this.isHeadless) { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException + | UnsupportedLookAndFeelException e) { + // Use whatever look-and-feel comes by default then + } + + showSplash(); } - - showSplash(); + } catch (Exception e) { + LOGGER.info("Unable to initialize GUI: {}", e.getMessage()); } }