timetracking: don't load notification icons for every panel

This commit is contained in:
Max Weber
2021-08-29 15:36:52 -06:00
parent a772eebf09
commit f1df57f9dd

View File

@@ -46,6 +46,9 @@ import net.runelite.client.util.SwingUtil;
@Getter @Getter
public class TimeablePanel<T> extends JPanel public class TimeablePanel<T> extends JPanel
{ {
private static final ImageIcon NOTIFY_ICON = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_icon.png"));
private static final ImageIcon NOTIFY_SELECTED_ICON = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_selected_icon.png"));
private final T timeable; private final T timeable;
private final JLabel icon = new JLabel(); private final JLabel icon = new JLabel();
private final JLabel farmingContractIcon = new JLabel(); private final JLabel farmingContractIcon = new JLabel();
@@ -84,13 +87,10 @@ public class TimeablePanel<T> extends JPanel
infoPanel.add(text); infoPanel.add(text);
infoPanel.add(estimate); infoPanel.add(estimate);
ImageIcon notifyIcon = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_icon.png"));
ImageIcon notifySelectedIcon = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_selected_icon.png"));
notifyButton.setPreferredSize(new Dimension(30, 16)); notifyButton.setPreferredSize(new Dimension(30, 16));
notifyButton.setBorder(new EmptyBorder(0, 0, 0, 10)); notifyButton.setBorder(new EmptyBorder(0, 0, 0, 10));
notifyButton.setIcon(notifyIcon); notifyButton.setIcon(NOTIFY_ICON);
notifyButton.setSelectedIcon(notifySelectedIcon); notifyButton.setSelectedIcon(NOTIFY_SELECTED_ICON);
SwingUtil.removeButtonDecorations(notifyButton); SwingUtil.removeButtonDecorations(notifyButton);
SwingUtil.addModalTooltip(notifyButton, "Disable notifications", "Enable notifications"); SwingUtil.addModalTooltip(notifyButton, "Disable notifications", "Enable notifications");