public void setVolume(final float fVolume) { jsVolume.removeChangeListener(CommandJPanel.this); jsVolume.removeMouseWheelListener(CommandJPanel.this); // if user move the volume slider, unmute if (Player.isMuted()) { Player.mute(false); } Player.setVolume(fVolume); jsVolume.addChangeListener(CommandJPanel.this); jsVolume.addMouseWheelListener(CommandJPanel.this); }
/** * Set Volume Icon. * * @param fVolume */ public static void setVolumeIcon(final float fVolume) { if (fVolume <= 0 || Player.isMuted()) { // We need to check if player is mute to handle cases when volume > 0 // and user muted jajuk in stopped state. ActionManager.getAction(MUTE_STATE).setIcon(IconLoader.getIcon(JajukIcons.MUTED)); } else if (fVolume <= 33) { ActionManager.getAction(MUTE_STATE).setIcon(IconLoader.getIcon(JajukIcons.VOLUME_LEVEL1)); } else if (fVolume <= 66) { ActionManager.getAction(MUTE_STATE).setIcon(IconLoader.getIcon(JajukIcons.VOLUME_LEVEL2)); } else { ActionManager.getAction(MUTE_STATE).setIcon(IconLoader.getIcon(JajukIcons.VOLUME_LEVEL3)); } }