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 311f41c610
.
This commit is contained in:
parent
cca5bac30a
commit
682a5fde94
@ -47,12 +47,12 @@ public class Gui {
|
||||
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)) {
|
||||
return ImageIO.read(in);
|
||||
} catch (IllegalArgumentException | IOException | ServiceConfigurationError e) {
|
||||
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;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.awt.image.BufferedImage;
|
||||
@ -30,23 +29,18 @@ public class SplashFrame {
|
||||
private JLabel statusLabel;
|
||||
|
||||
public SplashPanel() {
|
||||
try {
|
||||
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");
|
||||
}
|
||||
image = Gui.loadImage(defaultSplash);
|
||||
|
||||
setOpaque(true);
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
setBackground(Color.BLACK);
|
||||
|
||||
// Add logo
|
||||
JLabel imageLabel = new JLabel(new ImageIcon(image));
|
||||
imageLabel.setSize(new Dimension(300, 300));
|
||||
add(imageLabel);
|
||||
|
||||
// Add spacing
|
||||
add(Box.createRigidArea(new Dimension(0, 16)));
|
||||
|
||||
@ -81,20 +75,15 @@ public class SplashFrame {
|
||||
|
||||
this.splashDialog = new JFrame();
|
||||
|
||||
try {
|
||||
List<Image> icons = new ArrayList<>();
|
||||
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_syncing_time-alt.png"));
|
||||
icons.add(Gui.loadImage("icons/qortal_ui_tray_minting.png"));
|
||||
icons.add(Gui.loadImage("icons/qortal_ui_tray_syncing.png"));
|
||||
icons.add(Gui.loadImage("icons/icon64.png"));
|
||||
icons.add(Gui.loadImage("icons/Qlogo_128.png"));
|
||||
this.splashDialog.setIconImages(icons);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOGGER.warn("Unable to load splash frame icons");
|
||||
}
|
||||
List<Image> icons = new ArrayList<>();
|
||||
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_syncing_time-alt.png"));
|
||||
icons.add(Gui.loadImage("icons/qortal_ui_tray_minting.png"));
|
||||
icons.add(Gui.loadImage("icons/qortal_ui_tray_syncing.png"));
|
||||
icons.add(Gui.loadImage("icons/icon64.png"));
|
||||
icons.add(Gui.loadImage("icons/Qlogo_128.png"));
|
||||
this.splashDialog.setIconImages(icons);
|
||||
|
||||
this.splashPanel = new SplashPanel();
|
||||
this.splashDialog.getContentPane().add(this.splashPanel);
|
||||
|
@ -61,13 +61,7 @@ public class SysTray {
|
||||
this.popupMenu = createJPopupMenu();
|
||||
|
||||
// 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);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOGGER.warn("Unable to load system tray icon");
|
||||
return;
|
||||
}
|
||||
this.trayIcon = new TrayIcon(Gui.loadImage("icons/qortal_ui_tray_synced.png"), "qortal", null);
|
||||
// ...and attach mouse listener instead so we can use JPopupMenu (which does support Unicode)
|
||||
this.trayIcon.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user