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;
  }
Exemplo n.º 2
0
  private void addListListener(TextField k, TextField v, Button deleteButton) {
    k.textProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              buttonAddList.setDisable(false);
              HashMap<String, String> lists1 = Main.settings.getLists();
              String text = k.getText();
              String id = k.getId();
              String v1 = lists1.get(id);
              lists1.remove(id);
              lists1.put(text, v1);

              k.setId(text);

              Main.settings.setLists(lists1);
              save();
            });
    v.textProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              k.setDisable(false);
              HashMap<String, String> lists1 = Main.settings.getLists();
              lists1.put(v.getId().substring(1), v.getText());
              Main.settings.setLists(lists1);
              save();
            });
    deleteButton.setOnAction(
        event -> {
          k.setVisible(false);
          v.setVisible(false);
          deleteButton.setVisible(false);
          Main.settings.getLists().remove(k.getText());
          save();
        });
  }
  @Override
  void toggleControls(boolean visible) {
    tfKey.setVisible(visible);
    tfValue.setVisible(visible);

    tfKey.setText("");
    tfValue.setText("");
  }
 @Override
 void bindItem(Property newItem) {
   tfKey.textProperty().bindBidirectional(newItem.keyProperty());
   if (newItem.getValue().matches("#[0-9a-fA-F]{6}")) {
     cpColor.setVisible(true);
     tfValue.setVisible(false);
     cpColor.setValue(Color.web(newItem.getValue()));
     newItem.valueProperty().bindBidirectional(cpColor.valueProperty(), colorConverter);
   } else {
     cpColor.setVisible(false);
     tfValue.setVisible(true);
     tfValue.textProperty().bindBidirectional(newItem.valueProperty());
   }
 }
Exemplo n.º 5
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;
    }
  }