Skill calcs performance improvement

- Changed layout manager to DynamicGridLayout with a 5px hgap instead of
using rigid areas to add gaps.
- Removed useless bottom gap, and added bottom empty border
This commit is contained in:
Ruben Amendoeira
2018-05-25 00:17:38 +01:00
committed by Adam
parent 66a4911caa
commit e96d46b018
2 changed files with 4 additions and 8 deletions

View File

@@ -36,7 +36,6 @@ import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
@@ -48,6 +47,7 @@ import net.runelite.client.plugins.skillcalculator.beans.SkillData;
import net.runelite.client.plugins.skillcalculator.beans.SkillDataBonus;
import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.DynamicGridLayout;
import net.runelite.client.ui.FontManager;
class SkillCalculator extends JPanel
@@ -80,7 +80,7 @@ class SkillCalculator extends JPanel
this.client = client;
this.uiInput = uiInput;
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setLayout(new DynamicGridLayout(0, 1, 0, 5));
// Register listeners on the input fields and then move on to the next related text field
uiInput.uiFieldCurrentLevel.addActionListener(e ->
@@ -125,8 +125,6 @@ class SkillCalculator extends JPanel
// Create action slots for the skill actions.
renderActionSlots();
add(Box.createRigidArea(new Dimension(0, 15)));
// Update the input fields.
updateInputFields();
}
@@ -209,8 +207,6 @@ class SkillCalculator extends JPanel
{
UIActionSlot slot = new UIActionSlot(action);
uiActionSlots.add(slot); // Keep our own reference.
add(Box.createRigidArea(new Dimension(0, 5)));
add(slot); // Add component to the panel.
slot.addMouseListener(new MouseAdapter()
@@ -317,4 +313,4 @@ class SkillCalculator extends JPanel
{
return Math.min(MAX_XP, Math.max(0, input));
}
}
}

View File

@@ -77,7 +77,7 @@ class SkillCalculatorPanel extends PluginPanel
this.iconManager = iconManager;
setBorder(new EmptyBorder(10, 10, 0, 10));
setBorder(new EmptyBorder(10, 10, 10, 10));
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();