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);
 }
Exemplo n.º 2
0
 /**
  * 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));
   }
 }
Exemplo n.º 3
0
 /* (non-Javadoc)
  * @see org.jajuk.ui.actions.JajukAction#perform(java.awt.event.ActionEvent)
  */
 @Override
 public void perform(ActionEvent evt) {
   Player.mute();
   SwingUtilities.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           if (Player.isMuted()) {
             setName(Messages.getString("JajukWindow.1"));
           } else {
             setName(Messages.getString("JajukWindow.2"));
           }
           setVolumeIcon(100 * Player.getCurrentVolume());
         }
       });
 }