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:
@@ -36,7 +36,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.BoxLayout;
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
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.SkillDataBonus;
|
||||||
import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry;
|
import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry;
|
||||||
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;
|
||||||
|
|
||||||
class SkillCalculator extends JPanel
|
class SkillCalculator extends JPanel
|
||||||
@@ -80,7 +80,7 @@ class SkillCalculator extends JPanel
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
this.uiInput = uiInput;
|
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
|
// Register listeners on the input fields and then move on to the next related text field
|
||||||
uiInput.uiFieldCurrentLevel.addActionListener(e ->
|
uiInput.uiFieldCurrentLevel.addActionListener(e ->
|
||||||
@@ -125,8 +125,6 @@ class SkillCalculator extends JPanel
|
|||||||
// Create action slots for the skill actions.
|
// Create action slots for the skill actions.
|
||||||
renderActionSlots();
|
renderActionSlots();
|
||||||
|
|
||||||
add(Box.createRigidArea(new Dimension(0, 15)));
|
|
||||||
|
|
||||||
// Update the input fields.
|
// Update the input fields.
|
||||||
updateInputFields();
|
updateInputFields();
|
||||||
}
|
}
|
||||||
@@ -209,8 +207,6 @@ class SkillCalculator extends JPanel
|
|||||||
{
|
{
|
||||||
UIActionSlot slot = new UIActionSlot(action);
|
UIActionSlot slot = new UIActionSlot(action);
|
||||||
uiActionSlots.add(slot); // Keep our own reference.
|
uiActionSlots.add(slot); // Keep our own reference.
|
||||||
|
|
||||||
add(Box.createRigidArea(new Dimension(0, 5)));
|
|
||||||
add(slot); // Add component to the panel.
|
add(slot); // Add component to the panel.
|
||||||
|
|
||||||
slot.addMouseListener(new MouseAdapter()
|
slot.addMouseListener(new MouseAdapter()
|
||||||
@@ -317,4 +313,4 @@ class SkillCalculator extends JPanel
|
|||||||
{
|
{
|
||||||
return Math.min(MAX_XP, Math.max(0, input));
|
return Math.min(MAX_XP, Math.max(0, input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class SkillCalculatorPanel extends PluginPanel
|
|||||||
|
|
||||||
this.iconManager = iconManager;
|
this.iconManager = iconManager;
|
||||||
|
|
||||||
setBorder(new EmptyBorder(10, 10, 0, 10));
|
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
|||||||
Reference in New Issue
Block a user