コード例 #1
0
ファイル: GUIController.java プロジェクト: woekun/MediaPlayer
  @FXML
  private void Play(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
      if (j == 0) {
        listView.getSelectionModel().select(j);
        listView.getFocusModel().focus(j);
      }

      if (mp != null) {
        MediaPlayer.Status status = mp.getStatus();
        if (status == MediaPlayer.Status.UNKNOWN || status == MediaPlayer.Status.HALTED) {
          return;
        }
        if (status == MediaPlayer.Status.PAUSED
            || status == MediaPlayer.Status.READY
            || status == MediaPlayer.Status.STOPPED) {
          if (atEndOfMedia) {
            atEndOfMedia = false;
          }
          onPlay();
          mp.play();
          statusDisplay.toBack();
          play = true;

        } else {
          mp.pause();
          statusDisplay.toFront();
          play = false;
        }
      }
    }
  }
コード例 #2
0
 @Override
 public void pauseAudio() {
   try {
     myMusician.pause();
   } catch (Exception e) {
     /* does nothing if myMusician is not initialized */
   }
 }
コード例 #3
0
 @Override
 public void play() {
   if (player != null) {
     if (isPlaying) {
       player.pause();
       isPlaying = false;
       log.log(LogType.PLAYER, "Pause");
     } else {
       player.play();
       isPlaying = true;
       log.log(LogType.PLAYER, "Play");
     }
     UIManager.setPlayPauseIcon(isPlaying);
   }
 }
コード例 #4
0
 void pause(Runnable callback) {
   if (player != null) {
     new Tween(player.getVolume())
         .tweenToZero(
             0.06,
             10L,
             (curVolume) -> {
               player.setVolume(curVolume);
             },
             (zeroVolume) -> {
               player.pause();
               callback.run();
             });
     isPlaying = false;
   } else {
     callback.run();
   }
 }
コード例 #5
0
ファイル: FinalGame.java プロジェクト: NihalPandit/Work
  private void iniGame() {

    getImage();
    moves = 0;
    ep = 15;
    for (int i = 0; i < 16; i++) {
      iv[i] = new ImageView(IMAGE);
      iv[i].setViewport(rct[i]);
      gpane.add(iv[i], i % 4, i / 4);
      String a = "" + i;
      iv[i].setId(a);
    }
    iv[15].setViewport(rct[16]);

    exit.setOnMouseClicked(
        e -> {
          System.out.println("Exit Successful");
          System.exit(1);
        });
    sp.setText("Start");
    sp.setOnMouseClicked(
        e -> {
          if (done != true) {
            iv[15].setViewport(rct[15]);
            randomPic();
            gameTimer();
            startClick();
            songName = new TextField("s.mp3");
            songPath =
                "C:\\Users\\Nihal\\Google Drive\\SCHOOL\\Java 2\\Programs\\JavaFinalProject\\src\\javafinalproject\\";
            MiniMP3Player();
            mediaPlayer.stop();
            mediaPlayer.play();
            sp.setOnMouseClicked(null);
          }
        });
    stop.setOnMouseClicked(
        e -> {
          stopGame();
          mediaPlayer.pause();
        });
  }
コード例 #6
0
 @Override
 public void pause() {
   log.log(LogType.PLAYER, "pause");
   player.pause();
 }
コード例 #7
0
 @FXML
 public void pauseButton(ActionEvent event) {
   movie.pause();
 }