this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

faster icon loading

clover 5d7a576c 13e6ec1b

+70 -74
+1 -2
src/main/java/app/DetailedProgressDialog.java
··· 3 3 import java.awt.Dimension; 4 4 5 5 import javax.swing.JDialog; 6 - import javax.swing.JFrame; 7 6 import javax.swing.JLabel; 8 7 import javax.swing.JProgressBar; 9 8 10 9 import net.miginfocom.swing.MigLayout; 11 10 12 - public class DetailedProgressDialog extends JFrame 11 + public class DetailedProgressDialog extends StarRodFrame 13 12 { 14 13 public static void main(String args[]) 15 14 {
+8 -1
src/main/java/app/Environment.java
··· 1 1 package app; 2 2 3 + import java.awt.Frame; 3 4 import java.awt.Image; 4 5 import java.io.File; 5 6 import java.io.FileInputStream; ··· 464 465 mainConfig.saveConfigFile(); 465 466 466 467 readProjectConfig(); 468 + reloadIcons(); 467 469 468 470 ProjectDatabase.initialize(); 469 - reloadIcons(); 470 471 471 472 // set dump dir 472 473 File dumpDir = new File(usBaseRom.getParentFile(), "/dump/"); ··· 583 584 if (ICON_DEFAULT == null) 584 585 ICON_DEFAULT = loadIconResource(ResourceType.Icon, "icon.png"); 585 586 ICON_ERROR = loadIconAsset(ExpectedAsset.CRASH_GUY); 587 + 588 + for (Frame frame : Frame.getFrames()) { 589 + if (frame instanceof StarRodFrame srf) { 590 + srf.reloadIcon(); 591 + } 592 + } 586 593 } 587 594 588 595 public static final Image getDefaultIconImage()
+1 -3
src/main/java/app/LoadingBar.java
··· 8 8 import java.util.concurrent.ThreadLocalRandom; 9 9 10 10 import javax.imageio.ImageIO; 11 - import javax.swing.JFrame; 12 11 import javax.swing.JLabel; 13 12 import javax.swing.JProgressBar; 14 13 ··· 64 63 65 64 private static LoadingBarWindow instance; 66 65 67 - private static class LoadingBarWindow extends JFrame implements Listener 66 + private static class LoadingBarWindow extends StarRodFrame implements Listener 68 67 { 69 68 private final JProgressBar progressBar; 70 69 private final JLabel titleLabel; ··· 75 74 super(); 76 75 77 76 setTitle("Initializing"); 78 - setIconImage(Environment.getDefaultIconImage()); 79 77 80 78 setMinimumSize(new Dimension(320, 64)); 81 79 setLocationRelativeTo(null);
+2 -5
src/main/java/app/StackTraceDialog.java
··· 8 8 import java.io.File; 9 9 10 10 import javax.swing.JDialog; 11 - import javax.swing.JFrame; 12 11 import javax.swing.JOptionPane; 13 12 import javax.swing.JScrollPane; 14 13 import javax.swing.JTextArea; ··· 37 36 38 37 public static void display(Throwable t, File log) 39 38 { 40 - JFrame dialogFrame = new JFrame("Exception"); 39 + StarRodFrame dialogFrame = new StarRodFrame("Exception"); 41 40 dialogFrame.setUndecorated(true); 42 41 dialogFrame.setVisible(true); 43 - dialogFrame.setIconImage(Environment.getDefaultIconImage()); 44 42 45 43 new StackTraceDialog(dialogFrame, t, log); 46 44 dialogFrame.dispose(); 47 45 } 48 46 49 - private StackTraceDialog(JFrame frame, Throwable e, File log) 47 + private StackTraceDialog(StarRodFrame frame, Throwable e, File log) 50 48 { 51 49 super(frame, true); 52 50 logFile = log; ··· 69 67 frame.setTitle(title); 70 68 71 69 setTitle(title); 72 - setIconImage(Environment.getDefaultIconImage()); 73 70 74 71 textArea.append(e.getClass() + System.lineSeparator()); 75 72 for (StackTraceElement ele : stackTrace) {
+25
src/main/java/app/StarRodFrame.java
··· 1 + package app; 2 + 3 + import javax.swing.JFrame; 4 + 5 + public class StarRodFrame extends JFrame 6 + { 7 + public StarRodFrame() 8 + { 9 + super(); 10 + 11 + reloadIcon(); 12 + } 13 + 14 + public StarRodFrame(String title) 15 + { 16 + super(title); 17 + 18 + reloadIcon(); 19 + } 20 + 21 + public void reloadIcon() 22 + { 23 + setIconImage(Environment.getDefaultIconImage()); 24 + } 25 + }
+1 -3
src/main/java/app/StarRodMain.java
··· 20 20 import javax.swing.AbstractButton; 21 21 import javax.swing.ImageIcon; 22 22 import javax.swing.JButton; 23 - import javax.swing.JFrame; 24 23 import javax.swing.JLabel; 25 24 import javax.swing.JMenuItem; 26 25 import javax.swing.JOptionPane; ··· 62 61 import util.Logger.Listener; 63 62 import util.Priority; 64 63 65 - public class StarRodMain extends JFrame 64 + public class StarRodMain extends StarRodFrame 66 65 { 67 66 public static void main(String[] args) throws InterruptedException 68 67 { ··· 95 94 { 96 95 setTitle(Environment.decorateTitle("Star Rod")); 97 96 setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 98 - setIconImage(Environment.getDefaultIconImage()); 99 97 100 98 setMinimumSize(new Dimension(480, 32)); 101 99 setLocationRelativeTo(null);
+4 -6
src/main/java/app/SwingUtils.java
··· 18 18 import javax.swing.JComboBox; 19 19 import javax.swing.JComponent; 20 20 import javax.swing.JDialog; 21 - import javax.swing.JFrame; 22 21 import javax.swing.JLabel; 23 22 import javax.swing.JOptionPane; 24 23 import javax.swing.JSpinner; ··· 63 62 } 64 63 } 65 64 66 - private static final JFrame createDialogFrame(Component parentComponent, String title) 65 + private static final StarRodFrame createDialogFrame(Component parentComponent, String title) 67 66 { 68 - JFrame dialogFrame = new JFrame(title); 67 + StarRodFrame dialogFrame = new StarRodFrame(title); 69 68 dialogFrame.setUndecorated(true); 70 69 dialogFrame.setVisible(true); 71 70 dialogFrame.pack(); 72 71 dialogFrame.setLocationRelativeTo(parentComponent); 73 - dialogFrame.setIconImage(Environment.getDefaultIconImage()); 74 72 return dialogFrame; 75 73 } 76 74 ··· 267 265 if (counter != null) 268 266 counter.increment(); 269 267 270 - JFrame dialogFrame = createDialogFrame(parentComponent, title); 268 + StarRodFrame dialogFrame = createDialogFrame(parentComponent, title); 271 269 272 270 Object result = JOptionPane.showInputDialog(parentComponent, 273 271 message, title, messageType, ··· 286 284 if (counter != null) 287 285 counter.increment(); 288 286 289 - JFrame dialogFrame = createDialogFrame(parentComponent, title); 287 + StarRodFrame dialogFrame = createDialogFrame(parentComponent, title); 290 288 291 289 int result = JOptionPane.showOptionDialog(parentComponent, 292 290 message, title, optionType, messageType,
+2 -4
src/main/java/app/ThemesEditor.java
··· 9 9 import javax.swing.JButton; 10 10 import javax.swing.JCheckBox; 11 11 import javax.swing.JComboBox; 12 - import javax.swing.JFrame; 13 12 import javax.swing.JLabel; 14 13 import javax.swing.JList; 15 14 import javax.swing.JOptionPane; ··· 35 34 public static final int WINDOW_SIZE_X = 640; 36 35 public static final int WINDOW_SIZE_Y = 600; 37 36 38 - private JFrame frame; 37 + private StarRodFrame frame; 39 38 public boolean exitToMainMenu; 40 39 41 40 public String initialThemeName; ··· 59 58 { 60 59 initialThemeName = Themes.getCurrentThemeName(); 61 60 62 - frame = new JFrame(); 61 + frame = new StarRodFrame(); 63 62 64 63 frame.setTitle(Environment.decorateTitle("Choose Theme")); 65 - frame.setIconImage(Environment.getDefaultIconImage()); 66 64 67 65 frame.setBounds(0, 0, WINDOW_SIZE_X, WINDOW_SIZE_Y); 68 66 frame.setLocationRelativeTo(null);
+3 -5
src/main/java/game/globals/editor/GlobalsEditor.java
··· 14 14 import javax.imageio.ImageIO; 15 15 import javax.swing.DefaultComboBoxModel; 16 16 import javax.swing.ImageIcon; 17 - import javax.swing.JFrame; 18 17 import javax.swing.JLabel; 19 18 import javax.swing.JMenu; 20 19 import javax.swing.JMenuBar; ··· 27 26 28 27 import app.Environment; 29 28 import app.LoadingBar; 29 + import app.StarRodFrame; 30 30 import app.SwingUtils; 31 31 import app.config.Options; 32 32 import assets.AssetHandle; ··· 50 50 public static final int WINDOW_SIZE_X = 800; 51 51 public static final int WINDOW_SIZE_Y = 800; 52 52 53 - private JFrame frame; 53 + private StarRodFrame frame; 54 54 public boolean exitToMainMenu; 55 55 56 56 private JTabbedPane tabbedPane; ··· 194 194 195 195 private void createGUI(CountDownLatch guiClosedSignal) 196 196 { 197 - frame = new JFrame(); 197 + frame = new StarRodFrame(); 198 198 199 199 frame.setTitle(Environment.decorateTitle("Globals Editor")); 200 - frame.setIconImage(Environment.getDefaultIconImage()); 201 - 202 200 frame.setBounds(0, 0, WINDOW_SIZE_X, WINDOW_SIZE_Y); 203 201 frame.setLocationRelativeTo(null); 204 202
+4 -6
src/main/java/game/map/editor/common/BaseEditor.java
··· 23 23 import java.util.concurrent.CountDownLatch; 24 24 25 25 import javax.swing.JButton; 26 - import javax.swing.JFrame; 27 26 import javax.swing.JLabel; 28 27 import javax.swing.JMenuBar; 29 28 import javax.swing.JOptionPane; ··· 42 41 import app.Environment; 43 42 import app.LoadingBar; 44 43 import app.StarRodException; 44 + import app.StarRodFrame; 45 45 import app.StarRodMain; 46 46 import app.SwingUtils; 47 47 import app.SwingUtils.DialogBuilder; ··· 83 83 private List<Tickable> tickers = new ArrayList<>(); 84 84 85 85 // swing components 86 - private JFrame frame; 86 + private StarRodFrame frame; 87 87 private FadingLabel infoLabel; 88 88 private JMenuBar menuBar; 89 89 ··· 304 304 305 305 private final void createFrame(BaseEditorSettings windowSettings) 306 306 { 307 - frame = new JFrame(); 307 + frame = new StarRodFrame(); 308 308 309 309 if (windowSettings.fullscreen) 310 310 frame.setExtendedState(Frame.MAXIMIZED_BOTH); ··· 316 316 317 317 frame.setLocationRelativeTo(null); 318 318 frame.setTitle(windowSettings.title); 319 - 320 - frame.setIconImage(windowSettings.iconImage); 321 319 322 320 keyboard = new KeyboardInput(glCanvas); 323 321 mouse = new MouseInput(glCanvas); ··· 625 623 openDialogs.decrement(); 626 624 } 627 625 628 - protected final JFrame getFrame() 626 + protected final StarRodFrame getFrame() 629 627 { 630 628 return frame; 631 629 }
-9
src/main/java/game/map/editor/common/BaseEditorSettings.java
··· 1 1 package game.map.editor.common; 2 2 3 - import java.awt.Image; 4 - 5 3 import app.config.Options.Scope; 6 4 7 5 public class BaseEditorSettings ··· 17 15 public int targetFPS = 60; 18 16 19 17 public String title = null; 20 - public Image iconImage; 21 18 22 19 public boolean hasLog = false; 23 20 public String logName; ··· 72 69 hasConfig = true; 73 70 configFileName = name; 74 71 configScope = scope; 75 - return this; 76 - } 77 - 78 - public BaseEditorSettings setIcon(Image icon) 79 - { 80 - iconImage = icon; 81 72 return this; 82 73 } 83 74
+2 -5
src/main/java/game/map/editor/ui/SwingGUI.java
··· 26 26 import javax.swing.JButton; 27 27 import javax.swing.JCheckBoxMenuItem; 28 28 import javax.swing.JColorChooser; 29 - import javax.swing.JFrame; 30 29 import javax.swing.JLabel; 31 30 import javax.swing.JMenu; 32 31 import javax.swing.JMenuBar; ··· 49 48 import org.apache.commons.io.FilenameUtils; 50 49 51 50 import app.Environment; 51 + import app.StarRodFrame; 52 52 import app.SwingUtils; 53 53 import app.SwingUtils.OpenDialogCounter; 54 54 import app.config.PreferencesPanel; ··· 106 106 import util.Logger.Message; 107 107 import util.ui.DialogResult; 108 108 109 - public final class SwingGUI extends JFrame implements ActionListener, Logger.Listener, IShutdownListener 109 + public final class SwingGUI extends StarRodFrame implements ActionListener, Logger.Listener, IShutdownListener 110 110 { 111 111 public static final int SIDE_PANEL_WIDTH = 400; 112 112 ··· 205 205 desktopY = (int) displaySize.getHeight(); 206 206 setMinimumSize(new Dimension(800, 600)); 207 207 setPreferredSize(new Dimension(desktopX * 4 / 5, desktopY * 4 / 5)); 208 - 209 - // set icon 210 - setIconImage(Environment.getDefaultIconImage()); 211 208 212 209 // handle window closing 213 210 setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+1 -2
src/main/java/game/map/editor/ui/dialogs/GeneratePrimitiveOptionsDialog.java
··· 17 17 import javax.swing.ListCellRenderer; 18 18 import javax.swing.WindowConstants; 19 19 20 - import game.map.editor.geometry.Vector3f; 21 - 22 20 import app.SwingUtils; 23 21 import game.map.editor.MapEditor; 22 + import game.map.editor.geometry.Vector3f; 24 23 import game.map.editor.geometry.primitive.BeveledCubeGenerator; 25 24 import game.map.editor.geometry.primitive.ConeGenerator; 26 25 import game.map.editor.geometry.primitive.CubeGenerator;
+5 -6
src/main/java/game/message/editor/ColorSelectionDialogPanel.java
··· 5 5 import javax.swing.ImageIcon; 6 6 import javax.swing.JButton; 7 7 import javax.swing.JDialog; 8 - import javax.swing.JFrame; 9 8 10 9 import app.Environment; 10 + import app.StarRodFrame; 11 11 import app.SwingUtils; 12 12 import net.miginfocom.swing.MigLayout; 13 13 ··· 23 23 previews = images; 24 24 } 25 25 26 - private ColorSelectionDialogPanel(JFrame parent) 26 + private ColorSelectionDialogPanel(StarRodFrame parent) 27 27 { 28 28 super(parent, true); 29 29 ··· 60 60 61 61 public static int showFramedDialog(Component parentComponent) 62 62 { 63 - JFrame dialogFrame = createDialogFrame(parentComponent, TITLE); 63 + StarRodFrame dialogFrame = createDialogFrame(parentComponent, TITLE); 64 64 ColorSelectionDialogPanel panel = new ColorSelectionDialogPanel(dialogFrame); 65 65 dialogFrame.setResizable(false); 66 66 dialogFrame.pack(); ··· 78 78 return panel.result; 79 79 } 80 80 81 - private static final JFrame createDialogFrame(Component parentComponent, String title) 81 + private static final StarRodFrame createDialogFrame(Component parentComponent, String title) 82 82 { 83 - JFrame dialogFrame = new JFrame(title); 83 + StarRodFrame dialogFrame = new StarRodFrame(title); 84 84 dialogFrame.setUndecorated(true); 85 85 dialogFrame.setVisible(true); 86 86 dialogFrame.setLocationRelativeTo(parentComponent); 87 - dialogFrame.setIconImage(Environment.getDefaultIconImage()); 88 87 return dialogFrame; 89 88 } 90 89 }
+2 -3
src/main/java/game/message/editor/MessageEditor.java
··· 106 106 107 107 private static final BaseEditorSettings EDITOR_SETTINGS = BaseEditorSettings.create() 108 108 .setTitle(Environment.decorateTitle("Message Editor")) 109 - .setIcon(Environment.getDefaultIconImage()) 110 109 .setConfig(Scope.StringEditor, FN_STRING_EDITOR_CONFIG) 111 110 .setLog("msg_editor.log") 112 111 .setFullscreen(false) ··· 552 551 553 552 String selected = inputTextPane.getSelectedText(); 554 553 if (selected != null && !selected.isEmpty()) 555 - inputTextPane.replaceSelection(String.format("[SaveColor][Color:%02X]%s[RestoreColor]", result, inputTextPane.getSelectedText())); 554 + inputTextPane.replaceSelection(String.format("[SaveColor][Color 0x%X]%s[RestoreColor]", result, inputTextPane.getSelectedText())); 556 555 else 557 - inputTextPane.replaceSelection(String.format("[Color:%02X]", result)); 556 + inputTextPane.replaceSelection(String.format("[Color 0x%X]", result)); 558 557 } 559 558 560 559 private JMenu addMenuCategory(JPopupMenu menu, String name)
+5 -7
src/main/java/game/sprite/editor/ImportOptionsDialog.java
··· 4 4 5 5 import javax.swing.JButton; 6 6 import javax.swing.JDialog; 7 - import javax.swing.JFrame; 8 7 import javax.swing.SwingConstants; 9 8 10 - import app.Environment; 9 + import app.StarRodFrame; 11 10 import app.SwingUtils; 12 11 import net.miginfocom.swing.MigLayout; 13 12 ··· 17 16 public static final int RASTER = 1; 18 17 public static final int PALETTE = 2; 19 18 20 - private JFrame dialogFrame; 19 + private StarRodFrame dialogFrame; 21 20 private int selected = CANCEL; 22 21 23 - public static int display(JFrame parent) 22 + public static int display(StarRodFrame parent) 24 23 { 25 - JFrame dialogFrame = new JFrame("Import Options"); 24 + StarRodFrame dialogFrame = new StarRodFrame("Import Options"); 26 25 dialogFrame.setUndecorated(true); 27 26 dialogFrame.setVisible(true); 28 - dialogFrame.setIconImage(Environment.getDefaultIconImage()); 29 27 30 28 ImportOptionsDialog dialog = new ImportOptionsDialog(dialogFrame); 31 29 return dialog.selected; 32 30 } 33 31 34 - private ImportOptionsDialog(JFrame dialogFrame) 32 + private ImportOptionsDialog(StarRodFrame dialogFrame) 35 33 { 36 34 super(dialogFrame, "Import Options", true); 37 35 this.dialogFrame = dialogFrame;
+3 -4
src/main/java/game/sprite/editor/SpriteEditor.java
··· 91 91 92 92 private static final BaseEditorSettings EDITOR_SETTINGS = BaseEditorSettings.create() 93 93 .setTitle(Environment.decorateTitle("Sprite Editor")) 94 - .setIcon(Environment.getDefaultIconImage()) 95 94 .setConfig(Scope.SpriteEditor, FN_SPRITE_EDITOR_CONFIG) 96 95 .setLog("sprite_editor.log") 97 96 .setFullscreen(true) ··· 972 971 try { 973 972 int id = SpriteLoader.getMaximumID(spriteSet) + 1; 974 973 SpriteLoader.create(spriteSet, id); 975 - 974 + 976 975 if(spriteSet == SpriteSet.Npc) 977 976 useNpcFiles(id); 978 977 else 979 978 usePlayerFiles(id); 980 - 979 + 981 980 } catch (Throwable t) { 982 981 Logger.logError("Failed to create new sprite."); 983 982 incrementDialogsOpen(); ··· 987 986 }); 988 987 }); 989 988 menu.add(item); 990 - 989 + 991 990 menu.addSeparator(); 992 991 */ 993 992
+1 -2
src/main/java/game/texture/editor/ImageEditor.java
··· 79 79 80 80 private static final BaseEditorSettings EDITOR_SETTINGS = BaseEditorSettings.create() 81 81 .setTitle(Environment.decorateTitle("Image Editor")) 82 - .setIcon(Environment.getDefaultIconImage()) 83 82 .setLog("image_editor.log") 84 83 .setFullscreen(true) 85 84 .setResizeable(true) ··· 1195 1194 else 1196 1195 image.draw(mousePixelX, mousePixelY, pickedPixel); 1197 1196 } 1198 - 1197 + 1199 1198 if(mouseManager.holdingRMB && mousePixelValid) 1200 1199 image.deselect(mousePixelX, mousePixelY); 1201 1200 */
-1
src/main/java/game/worldmap/WorldMapEditor.java
··· 66 66 67 67 private static final BaseEditorSettings EDITOR_SETTINGS = BaseEditorSettings.create() 68 68 .setTitle(Environment.decorateTitle("World Map Editor")) 69 - .setIcon(Environment.getDefaultIconImage()) 70 69 .setLog("world_map_editor.log") 71 70 .setFullscreen(true) 72 71 .setResizeable(true)