forked from Qortal/qortal
Revert "Attempt to fix core startup problems on some systems (GNOME Desktop?) by adding defensiveness to GUI elements."
This reverts commit 311f41c610b7d3388cef714979d9653508fb0c55.
This commit is contained in:
parent
cca5bac30a
commit
682a5fde94
@ -47,12 +47,12 @@ public class Gui {
|
|||||||
this.splashFrame = SplashFrame.getInstance();
|
this.splashFrame = SplashFrame.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static BufferedImage loadImage(String resourceName) throws IOException {
|
protected static BufferedImage loadImage(String resourceName) {
|
||||||
try (InputStream in = Gui.class.getResourceAsStream("/images/" + resourceName)) {
|
try (InputStream in = Gui.class.getResourceAsStream("/images/" + resourceName)) {
|
||||||
return ImageIO.read(in);
|
return ImageIO.read(in);
|
||||||
} catch (IllegalArgumentException | IOException | ServiceConfigurationError e) {
|
} catch (IllegalArgumentException | IOException | ServiceConfigurationError e) {
|
||||||
LOGGER.warn(String.format("Couldn't locate image resource \"images/%s\"", resourceName));
|
LOGGER.warn(String.format("Couldn't locate image resource \"images/%s\"", resourceName));
|
||||||
throw new IOException(String.format("Couldn't locate image resource \"images/%s\"", resourceName));
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.qortal.gui;
|
package org.qortal.gui;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@ -30,23 +29,18 @@ public class SplashFrame {
|
|||||||
private JLabel statusLabel;
|
private JLabel statusLabel;
|
||||||
|
|
||||||
public SplashPanel() {
|
public SplashPanel() {
|
||||||
try {
|
|
||||||
image = Gui.loadImage(defaultSplash);
|
image = Gui.loadImage(defaultSplash);
|
||||||
|
|
||||||
// Add logo
|
|
||||||
JLabel imageLabel = new JLabel(new ImageIcon(image));
|
|
||||||
imageLabel.setSize(new Dimension(300, 300));
|
|
||||||
add(imageLabel);
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
LOGGER.warn("Unable to load splash panel image");
|
|
||||||
}
|
|
||||||
|
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
setBackground(Color.BLACK);
|
setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
// Add logo
|
||||||
|
JLabel imageLabel = new JLabel(new ImageIcon(image));
|
||||||
|
imageLabel.setSize(new Dimension(300, 300));
|
||||||
|
add(imageLabel);
|
||||||
|
|
||||||
// Add spacing
|
// Add spacing
|
||||||
add(Box.createRigidArea(new Dimension(0, 16)));
|
add(Box.createRigidArea(new Dimension(0, 16)));
|
||||||
|
|
||||||
@ -81,7 +75,6 @@ public class SplashFrame {
|
|||||||
|
|
||||||
this.splashDialog = new JFrame();
|
this.splashDialog = new JFrame();
|
||||||
|
|
||||||
try {
|
|
||||||
List<Image> icons = new ArrayList<>();
|
List<Image> icons = new ArrayList<>();
|
||||||
icons.add(Gui.loadImage("icons/icon16.png"));
|
icons.add(Gui.loadImage("icons/icon16.png"));
|
||||||
icons.add(Gui.loadImage("icons/qortal_ui_tray_synced.png"));
|
icons.add(Gui.loadImage("icons/qortal_ui_tray_synced.png"));
|
||||||
@ -91,10 +84,6 @@ public class SplashFrame {
|
|||||||
icons.add(Gui.loadImage("icons/icon64.png"));
|
icons.add(Gui.loadImage("icons/icon64.png"));
|
||||||
icons.add(Gui.loadImage("icons/Qlogo_128.png"));
|
icons.add(Gui.loadImage("icons/Qlogo_128.png"));
|
||||||
this.splashDialog.setIconImages(icons);
|
this.splashDialog.setIconImages(icons);
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
LOGGER.warn("Unable to load splash frame icons");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.splashPanel = new SplashPanel();
|
this.splashPanel = new SplashPanel();
|
||||||
this.splashDialog.getContentPane().add(this.splashPanel);
|
this.splashDialog.getContentPane().add(this.splashPanel);
|
||||||
|
@ -61,13 +61,7 @@ public class SysTray {
|
|||||||
this.popupMenu = createJPopupMenu();
|
this.popupMenu = createJPopupMenu();
|
||||||
|
|
||||||
// Build TrayIcon without AWT PopupMenu (which doesn't support Unicode)...
|
// Build TrayIcon without AWT PopupMenu (which doesn't support Unicode)...
|
||||||
try {
|
|
||||||
this.trayIcon = new TrayIcon(Gui.loadImage("icons/qortal_ui_tray_synced.png"), "qortal", null);
|
this.trayIcon = new TrayIcon(Gui.loadImage("icons/qortal_ui_tray_synced.png"), "qortal", null);
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
LOGGER.warn("Unable to load system tray icon");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// ...and attach mouse listener instead so we can use JPopupMenu (which does support Unicode)
|
// ...and attach mouse listener instead so we can use JPopupMenu (which does support Unicode)
|
||||||
this.trayIcon.addMouseListener(new MouseAdapter() {
|
this.trayIcon.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user