Use single DynamicGridLayout for XPTracker stats (#3432)
- Use single GridLayout for XPTracker stats - Use DynamicGridLayout to allow unequal sized columns - Remove hgap to ensure large numbers can fit - Prevent XP boxes from resizing - Decrease borders to make large numbers more readable
This commit is contained in:
@@ -28,7 +28,6 @@ package net.runelite.client.plugins.xptracker;
|
|||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridLayout;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -45,6 +44,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.client.game.SkillIconManager;
|
import net.runelite.client.game.SkillIconManager;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.components.ProgressBar;
|
import net.runelite.client.ui.components.ProgressBar;
|
||||||
import net.runelite.client.util.LinkBrowser;
|
import net.runelite.client.util.LinkBrowser;
|
||||||
@@ -81,7 +81,7 @@ class XpInfoBox extends JPanel
|
|||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
setBorder(new EmptyBorder(10, 0, 0, 0));
|
setBorder(new EmptyBorder(5, 0, 0, 0));
|
||||||
|
|
||||||
container.setLayout(new BorderLayout());
|
container.setLayout(new BorderLayout());
|
||||||
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
@@ -108,32 +108,19 @@ class XpInfoBox extends JPanel
|
|||||||
headerPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
headerPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
headerPanel.setLayout(new BorderLayout());
|
headerPanel.setLayout(new BorderLayout());
|
||||||
|
|
||||||
statsPanel.setLayout(new BorderLayout());
|
statsPanel.setLayout(new DynamicGridLayout(2, 2));
|
||||||
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
statsPanel.setBorder(new EmptyBorder(9, 5, 9, 10));
|
statsPanel.setBorder(new EmptyBorder(9, 2, 9, 2));
|
||||||
|
|
||||||
JPanel leftPanel = new JPanel();
|
|
||||||
leftPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
|
||||||
leftPanel.setLayout(new GridLayout(2, 1));
|
|
||||||
|
|
||||||
expGained.setFont(FontManager.getRunescapeSmallFont());
|
expGained.setFont(FontManager.getRunescapeSmallFont());
|
||||||
expHour.setFont(FontManager.getRunescapeSmallFont());
|
expHour.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
|
||||||
leftPanel.add(expGained);
|
|
||||||
leftPanel.add(expHour);
|
|
||||||
|
|
||||||
JPanel rightPanel = new JPanel();
|
|
||||||
rightPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
|
||||||
rightPanel.setLayout(new GridLayout(2, 1));
|
|
||||||
|
|
||||||
expLeft.setFont(FontManager.getRunescapeSmallFont());
|
expLeft.setFont(FontManager.getRunescapeSmallFont());
|
||||||
actionsLeft.setFont(FontManager.getRunescapeSmallFont());
|
actionsLeft.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
|
||||||
rightPanel.add(expLeft);
|
statsPanel.add(expGained);
|
||||||
rightPanel.add(actionsLeft);
|
statsPanel.add(expLeft);
|
||||||
|
statsPanel.add(expHour);
|
||||||
statsPanel.add(leftPanel, BorderLayout.WEST);
|
statsPanel.add(actionsLeft);
|
||||||
statsPanel.add(rightPanel, BorderLayout.EAST);
|
|
||||||
|
|
||||||
headerPanel.add(skillIcon, BorderLayout.WEST);
|
headerPanel.add(skillIcon, BorderLayout.WEST);
|
||||||
headerPanel.add(statsPanel, BorderLayout.CENTER);
|
headerPanel.add(statsPanel, BorderLayout.CENTER);
|
||||||
|
|||||||
@@ -67,12 +67,14 @@ class XpPanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
setBorder(new EmptyBorder(10, 6, 10, 6));
|
||||||
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
final JPanel layoutPanel = new JPanel();
|
final JPanel layoutPanel = new JPanel();
|
||||||
layoutPanel.setLayout(new BorderLayout());
|
BoxLayout boxLayout = new BoxLayout(layoutPanel, BoxLayout.Y_AXIS);
|
||||||
add(layoutPanel);
|
layoutPanel.setLayout(boxLayout);
|
||||||
|
add(layoutPanel, BorderLayout.NORTH);
|
||||||
|
|
||||||
overallPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
overallPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
@@ -113,8 +115,8 @@ class XpPanel extends PluginPanel
|
|||||||
|
|
||||||
final JPanel infoBoxPanel = new JPanel();
|
final JPanel infoBoxPanel = new JPanel();
|
||||||
infoBoxPanel.setLayout(new BoxLayout(infoBoxPanel, BoxLayout.Y_AXIS));
|
infoBoxPanel.setLayout(new BoxLayout(infoBoxPanel, BoxLayout.Y_AXIS));
|
||||||
layoutPanel.add(infoBoxPanel, BorderLayout.CENTER);
|
layoutPanel.add(overallPanel);
|
||||||
layoutPanel.add(overallPanel, BorderLayout.NORTH);
|
layoutPanel.add(infoBoxPanel);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user