Volume value is now padded to maintain ui element size.
This commit is contained in:
parent
cedd6bac8b
commit
3fb9dd1fa6
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user