private boolean handleSitLeave(
      boolean bSit,
      int iPlayerPosition,
      Label lblPlayer,
      TextField txtPlayer,
      ToggleButton btnSitLeave,
      HBox HBoxPlayerCards) {
    if (bSit == false) {
      Player p = new Player(txtPlayer.getText(), iPlayerPosition);
      mainApp.AddPlayerToTable(p);
      lblPlayer.setText(txtPlayer.getText());
      lblPlayer.setVisible(true);
      btnSitLeave.setText("Leave");
      txtPlayer.setVisible(false);
      bSit = true;
    } else {
      mainApp.RemovePlayerFromTable(iPlayerPosition);
      btnSitLeave.setText("Sit");
      txtPlayer.setVisible(true);
      lblPlayer.setVisible(false);
      HBoxPlayerCards.getChildren().clear();
      bSit = false;
    }

    return bSit;
  }
  private void createNewStage(int level, Stage owner, boolean onTop) {
    Stage stage = new Stage();
    stage.initOwner(owner);
    stage.setTitle(level == 0 ? "Root" : "Child " + level);
    stage.setAlwaysOnTop(onTop);

    VBox root = new VBox(15);
    root.setPadding(new Insets(20));
    Scene scene = new Scene(root);
    stage.setScene(scene);

    ToggleButton onTopButton = new ToggleButton(onTop ? DISABLE_ON_TOP : ENABLE_ON_TOP);
    onTopButton.setSelected(onTop);

    stage
        .alwaysOnTopProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              onTopButton.setSelected(newValue);
              onTopButton.setText(newValue ? DISABLE_ON_TOP : ENABLE_ON_TOP);
            });

    onTopButton.setOnAction(event -> stage.setAlwaysOnTop(!stage.isAlwaysOnTop()));

    CheckBox box = new CheckBox("Child stage always on top");
    box.setSelected(true);
    Button newStageButton = new Button("Open child stage");

    newStageButton.setOnAction(event -> createNewStage(level + 1, stage, box.isSelected()));

    root.getChildren().addAll(onTopButton, box, newStageButton);

    stage.show();
  }
예제 #3
0
  @FXML
  private void handleP4SitLeave() {

    int iPlayerPosition = 4;

    if (bP4Sit == false) {
      Player p = new Player(txtP4Name.getText(), iPlayerPosition);
      mainApp.AddPlayerToTable(p);
      lblP4Name.setText(txtP4Name.getText());
      lblP4Name.setVisible(true);
      btnP4SitLeave.setText("Leave");
      txtP4Name.setVisible(false);
      bP4Sit = true;
    } else {
      mainApp.RemovePlayerFromTable(iPlayerPosition);
      btnP4SitLeave.setText("Sit");
      txtP4Name.setVisible(true);
      lblP4Name.setVisible(false);
      bP4Sit = false;
    }
  }
예제 #4
0
 private void handleControlPropertyChanged(final String PROPERTY) {
   if ("LOAD_BACKGROUND".equals(PROPERTY)) {
     Image image = getImage(buttonLoadBackgroundImage.getScene().getWindow());
     if (null == image) return;
     backgroundImage.setImage(image);
     backgroundImage.toBack();
   } else if ("LOAD_HEATMAP".equals(PROPERTY)) {
     Image image = getImage(buttonLoadHeatMapImage.getScene().getWindow());
     if (null == image) return;
     heatMapImage.setImage(image);
     toggleButtonShowHeatMap.setSelected(true);
   } else if ("TOGGLE_HEATMAP".equals(PROPERTY)) {
     toggleButtonShowHeatMap.setText(toggleButtonShowHeatMap.isSelected() ? "show" : "hide");
     heatMapImage.setVisible(!toggleButtonShowHeatMap.isSelected());
   }
 }