made window look native and added icon
This commit is contained in:
@@ -5,6 +5,7 @@ import com.vaporvee.loadsupport.platform.Services;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Allocated {
|
||||
public static float memoryInGB;
|
||||
@@ -48,15 +49,18 @@ public class Allocated {
|
||||
try {
|
||||
if (enoughMemory) {
|
||||
enoughMemory = false;
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
String[] warning = getWarningMessage();
|
||||
errorWindow = new JFrame(warning[0]);
|
||||
Image icon = new ImageIcon(Objects.requireNonNull(Allocated.class.getResource("/assets/" + Constants.MOD_ID + "/icon.png"))).getImage();
|
||||
errorWindow.setIconImage(icon);
|
||||
errorWindow.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
errorWindow.setSize(500, 350);
|
||||
errorWindow.setLocationRelativeTo(null);
|
||||
|
||||
JLabel message = new JLabel(
|
||||
"<html><p style=\"width:290px; font-size:16px;\">" + warning[1] + "</p></html>",
|
||||
"<html><p style=\"width:350px; font-size:20px;\">" + warning[1] + "</p></html>",
|
||||
JLabel.CENTER
|
||||
);
|
||||
|
||||
@@ -88,8 +92,10 @@ public class Allocated {
|
||||
errorWindow.setVisible(true);
|
||||
});
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
} catch (RuntimeException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
Constants.LOG.error(String.valueOf(e));
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
common/src/main/resources/assets/loadsupport/icon.png
Normal file
BIN
common/src/main/resources/assets/loadsupport/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
@@ -12,7 +12,7 @@
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
},
|
||||
"license": "${license}",
|
||||
"icon": "${mod_id}.png",
|
||||
"icon": "assets/${mod_id}/icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
|
@@ -8,7 +8,7 @@ version = "${version}" #mandatory
|
||||
displayName = "${mod_name}" #mandatory
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional (see https://docs.neoforged.net/docs/misc/updatechecker/)
|
||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional (displayed in the mod UI)
|
||||
logoFile="${mod_id}.png" #optional
|
||||
logoFile="assets/${mod_id}/icon.png" #optional
|
||||
credits="${credits}" #optional
|
||||
authors = "${mod_author}" #optional
|
||||
description = '''${description}''' #mandatory (Supports multiline text)
|
||||
|
Reference in New Issue
Block a user