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.
This commit is contained in:
CalDescent 2021-08-09 10:02:24 +01:00
parent 78373f3746
commit c9596fd8c4

View File

@ -23,17 +23,21 @@ public class Gui {
private SysTray sysTray = null; private SysTray sysTray = null;
private Gui() { private Gui() {
this.isHeadless = GraphicsEnvironment.isHeadless(); try {
this.isHeadless = GraphicsEnvironment.isHeadless();
if (!this.isHeadless) { if (!this.isHeadless) {
try { try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e) { | UnsupportedLookAndFeelException e) {
// Use whatever look-and-feel comes by default then // Use whatever look-and-feel comes by default then
}
showSplash();
} }
} catch (Exception e) {
showSplash(); LOGGER.info("Unable to initialize GUI: {}", e.getMessage());
} }
} }