コード例 #1
0
 public synchronized void setPlayer(Player player) {
   if (this.player != null) {
     this.player.removeChangeListener(this);
     player.removePropertyChangeListener(this);
   }
   this.player = player;
   //        boundedRangeModel = player == null ? null : player.getBoundedRangeModel();
   boundedRangeModel = player == null ? null : player.getTimeModel();
   slider.setModel(boundedRangeModel);
   if (player != null) {
     if (player.getState() >= Player.REALIZED
         && boundedRangeModel != null
         && boundedRangeModel.getMaximum() == 0) {
       setPlayerControlsVisible(false);
     }
     slider.setProgressModel(player.getCachingModel());
     startButton.setSelected(player.isActive());
     player.addChangeListener(this);
     player.addPropertyChangeListener(this);
     audioButton.setVisible(player.isAudioAvailable());
     audioButton.setSelected(player.isAudioEnabled());
     colorCyclingButton.setVisible(
         (player instanceof ColorCyclePlayer)
             ? ((ColorCyclePlayer) player).isColorCyclingAvailable()
             : false);
     colorCyclingButton.setSelected(
         (player instanceof ColorCyclePlayer)
             ? ((ColorCyclePlayer) player).isColorCyclingStarted()
             : false);
     validate();
     repaint();
     BoundedRangeModel cachingControlModel = slider.getProgressModel();
   }
 }
コード例 #2
0
 public void setProgressModel(BoundedRangeModel brm) {
   slider.setProgressModel(brm);
 }