public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();
    if (boundedRangeModel != null) {
      int value = boundedRangeModel.getValue();
      if (source == forwardButton) {
        boundedRangeModel.setValue(
            value == boundedRangeModel.getMaximum() ? boundedRangeModel.getMinimum() : value + 1);
      } else if (source == rewindButton) {
        boundedRangeModel.setValue(
            value == boundedRangeModel.getMinimum() ? boundedRangeModel.getMaximum() : value - 1);
      } else if (source == startButton) {
        if (startButton.isSelected() != player.isActive()) {
          if (startButton.isSelected()) {
            player.start();
          } else {
            player.stop();
          }
        }
      } else if (source == audioButton) {

        player.setAudioEnabled(audioButton.isSelected());
      } else if (source == colorCyclingButton) {
        if (player instanceof ColorCyclePlayer) {
          ((ColorCyclePlayer) player).setColorCyclingStarted(colorCyclingButton.isSelected());
        }
      }
    }
  }
    // ChangeListener
    public void stateChanged(ChangeEvent e) {
      BoundedRangeModel model = progressBar.getModel();
      int newRange = model.getMaximum() - model.getMinimum();
      int newPercent;
      int oldPercent = getCachedPercent();

      if (newRange > 0) {
        newPercent = (int) ((100 * (long) model.getValue()) / newRange);
      } else {
        newPercent = 0;
      }

      if (newPercent != oldPercent) {
        setCachedPercent(newPercent);
        progressBar.repaint();
      }
    }
Exemplo n.º 3
0
  private void clearBuffer() {
    if (!myTerminalTextBuffer.isUsingAlternateBuffer()) {
      myTerminalTextBuffer.clearHistory();

      if (myCoordsAccessor != null && myCoordsAccessor.getY() > 0) {
        TerminalLine line = myTerminalTextBuffer.getLine(myCoordsAccessor.getY() - 1);

        myTerminalTextBuffer.clearAll();

        myCoordsAccessor.setY(0);
        myCursor.setY(1);
        myTerminalTextBuffer.addLine(line);
      }

      updateScrolling();

      myClientScrollOrigin = myBoundedRangeModel.getValue();
    }
  }
Exemplo n.º 4
0
 private void moveScrollBar(int k) {
   myBoundedRangeModel.setValue(myBoundedRangeModel.getValue() + k);
 }