ui: queue repaint when progressbar is edited

This commit is contained in:
Adam
2021-05-16 20:10:57 -04:00
parent 94ad05fa0f
commit 2a118bdb4d
2 changed files with 18 additions and 10 deletions

View File

@@ -304,14 +304,11 @@ class XpInfoBox extends JPanel
tooltipLabel == XpProgressBarLabel.PERCENTAGE ? "of goal" : "till goal lvl")); tooltipLabel == XpProgressBarLabel.PERCENTAGE ? "of goal" : "till goal lvl"));
progressBar.setDimmed(skillPaused); progressBar.setDimmed(skillPaused);
progressBar.repaint();
} }
else if (!paused && skillPaused) else if (!paused && skillPaused)
{ {
// React to the skill state now being paused // React to the skill state now being paused
progressBar.setDimmed(true); progressBar.setDimmed(true);
progressBar.repaint();
paused = true; paused = true;
pauseSkill.setText("Unpause"); pauseSkill.setText("Unpause");
} }
@@ -319,7 +316,6 @@ class XpInfoBox extends JPanel
{ {
// React to the skill being unpaused (without update) // React to the skill being unpaused (without update)
progressBar.setDimmed(false); progressBar.setDimmed(false);
progressBar.repaint();
paused = false; paused = false;
pauseSkill.setText("Pause"); pauseSkill.setText("Pause");
} }

View File

@@ -33,7 +33,6 @@ import java.util.List;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import lombok.Setter;
import net.runelite.client.ui.FontManager; import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
@@ -42,13 +41,8 @@ import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
*/ */
public class ProgressBar extends DimmableJPanel public class ProgressBar extends DimmableJPanel
{ {
@Setter
private int maximumValue; private int maximumValue;
@Setter
private int value; private int value;
@Setter
private List<Integer> positions = Collections.emptyList(); private List<Integer> positions = Collections.emptyList();
private final JLabel leftLabel = new JShadowedLabel(); private final JLabel leftLabel = new JShadowedLabel();
@@ -157,4 +151,22 @@ public class ProgressBar extends DimmableJPanel
return (value * 100) / maximumValue; return (value * 100) / maximumValue;
} }
public void setMaximumValue(int maximumValue)
{
this.maximumValue = maximumValue;
repaint();
}
public void setValue(int value)
{
this.value = value;
repaint();
}
public void setPositions(List<Integer> positions)
{
this.positions = positions;
repaint();
}
} }