I'd like to mute my music player player
using player.mute()
when the JCheckBox mutemusic_box
is checked.
If its unchecked and the player
is muted, the command player.mute()
should execute. How to get this working? My code currently does not work (may because of the ActionEvent).
The check if it's checked or not is in actionPerformed
.
private JCheckBox pwremember_box, mutemusic_checkbox;
//GUI setup
public void actionPerformed(ActionEvent ae) {
if (mutemusic_checkbox.isSelected()) {
System.out.println("Muted!");
player.mute();
}
else {
System.out.println("Unmuted!");
player.mute();
}
}