From eeecb23639324c99d45ddbc897cc4870c7df1991 Mon Sep 17 00:00:00 2001 From: Quinten Cabo Date: Fri, 26 Jan 2024 23:06:05 +0100 Subject: [PATCH] Add a tooltip to each label and image with the description of the pack or mod. This should close #36. For some reason the tooltips only show up if you are not on the first tab of the JTabbedPane. --- .../java/io/github/koxx12dev/universal/guis/Installer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/io/github/koxx12dev/universal/guis/Installer.java b/src/main/java/io/github/koxx12dev/universal/guis/Installer.java index b2abddf..c2ad5b6 100644 --- a/src/main/java/io/github/koxx12dev/universal/guis/Installer.java +++ b/src/main/java/io/github/koxx12dev/universal/guis/Installer.java @@ -284,6 +284,7 @@ public void addModPanel(int modPos, int pos) throws IOException { Name.setPreferredSize(new Dimension(150, 67)); Name.setMinimumSize(new Dimension(150, 67)); Name.setText(mod.getDisplay()); + Name.setToolTipText(mod.getDescription()); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; @@ -292,6 +293,7 @@ public void addModPanel(int modPos, int pos) throws IOException { JLabel Image = new JLabel(); Image.setHorizontalAlignment(SwingConstants.LEFT); Image.setHorizontalTextPosition(SwingConstants.TRAILING); + Image.setToolTipText(mod.getDescription()); BufferedImage icon; if (mod.icon != null) { if (new File(SkyclientUniversal.cache, mod.getIcon()).exists()) { @@ -450,6 +452,7 @@ public void addPackPanel(int packPos, int pos) throws IOException { Name.setPreferredSize(new Dimension(150, 67)); Name.setMinimumSize(new Dimension(150, 67)); Name.setText(pack.getDisplay()); + Name.setToolTipText(pack.getDescription()); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; @@ -458,6 +461,7 @@ public void addPackPanel(int packPos, int pos) throws IOException { JLabel Image = new JLabel(); Image.setHorizontalAlignment(SwingConstants.LEFT); Image.setHorizontalTextPosition(SwingConstants.TRAILING); + Image.setToolTipText(pack.getDescription()); BufferedImage icon; if (new File(SkyclientUniversal.cache, pack.getIcon()).exists()) { icon = resize(ImageIO.read(new File(SkyclientUniversal.cache, pack.getIcon())), 50, 50, Objects.equals(pack.icon_scaling, "pixel"));