adjust panels and components to work with any font
This commit is contained in:
@@ -40,6 +40,7 @@ import net.runelite.client.plugins.timetracking.TimeTrackingPlugin;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.DynamicGridLayout;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.client.ui.components.IconButton;
|
||||
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
@@ -97,6 +98,13 @@ public class ClockTabPanel extends TabContentPanel
|
||||
rebuild();
|
||||
}
|
||||
|
||||
// The max panel width is 225 but the + sign gets cut off at 225 so we set it at 223
|
||||
@Override
|
||||
public Dimension getPreferredSize()
|
||||
{
|
||||
return new Dimension(PluginPanel.PANEL_WIDTH - 2, super.getPreferredSize().height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears and recreates the components of this panel.
|
||||
* This should be done whenever a clock is added or removed.
|
||||
|
||||
@@ -66,18 +66,26 @@ public class ProgressBar extends DimmableJPanel
|
||||
|
||||
setPreferredSize(new Dimension(100, 16));
|
||||
|
||||
int topIndent = 0;
|
||||
if (getFont().equals(FontManager.getRunescapeSmallFont())
|
||||
|| getFont().equals(FontManager.getRunescapeFont())
|
||||
|| getFont().equals(FontManager.getRunescapeBoldFont()))
|
||||
{
|
||||
topIndent = 2;
|
||||
}
|
||||
|
||||
leftLabel.setFont(FontManager.getRunescapeSmallFont());
|
||||
leftLabel.setForeground(Color.WHITE);
|
||||
leftLabel.setBorder(new EmptyBorder(2, 5, 0, 0));
|
||||
leftLabel.setBorder(new EmptyBorder(topIndent, 5, 0, 0));
|
||||
|
||||
rightLabel.setFont(FontManager.getRunescapeSmallFont());
|
||||
rightLabel.setForeground(Color.WHITE);
|
||||
rightLabel.setBorder(new EmptyBorder(2, 0, 0, 5));
|
||||
rightLabel.setBorder(new EmptyBorder(topIndent, 0, 0, 5));
|
||||
|
||||
centerLabel.setFont(FontManager.getRunescapeSmallFont());
|
||||
centerLabel.setForeground(Color.WHITE);
|
||||
centerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
centerLabel.setBorder(new EmptyBorder(2, 0, 0, 0));
|
||||
centerLabel.setBorder(new EmptyBorder(topIndent, 0, 0, 0));
|
||||
|
||||
// Adds components to be automatically redrawn when paintComponents is called
|
||||
add(leftLabel, BorderLayout.WEST);
|
||||
|
||||
Reference in New Issue
Block a user