diff --git a/src/main/java/musicplayer/swingui/PlayerGUI.java b/src/main/java/musicplayer/swingui/PlayerGUI.java index 4aaa0ac..3f42d44 100644 --- a/src/main/java/musicplayer/swingui/PlayerGUI.java +++ b/src/main/java/musicplayer/swingui/PlayerGUI.java @@ -153,16 +153,21 @@ public class PlayerGUI extends JPanel implements PlayerCallbackInterface { volumeSlider.setValue(player.getVolume()); panel.add(volumeSlider); JLabel volumeValue = new JLabel(); - volumeValue.setText(String.format("%d%%", player.getVolume())); + volumeValue.setText(volumeFormat(player.getVolume())); volumeSlider.addChangeListener(e -> { player.setVolume(((JSlider) e.getSource()).getValue()); - volumeValue.setText(String.format("%d%%", player.getVolume())); + volumeValue.setText(volumeFormat(player.getVolume())); ConfigManager.setLastVolume(player.getVolume()); }); panel.add(volumeValue); return panel; } + private String volumeFormat(int volume){ + return String.format("%03d%%", volume); + + } + /** * Populate the top menu bar with items. */