@FXML
  private void buttonCheckClicked(Event event) {
    DefectSet leftSide = new DefectSet(prefix);
    DefectSet rightSide = new DefectSet(prefix);

    leftSide.load(textInputLeft.getText(), textPrefix.getText(), textMax.getText());
    rightSide.load(textInputRight.getText(), textPrefix.getText(), textMax.getText());

    labelInputLeft.setText(leftSide.size() + " defect(s) found.");
    labelInputRight.setText(rightSide.size() + " defect(s) found.");

    DefectSet outputLeft = leftSide.subtract(rightSide);
    DefectSet outputRight = rightSide.subtract(leftSide);
    DefectSet intersect = leftSide.intersect(rightSide);

    textOutputLeft.setStyle("-fx-text-fill: blue;");
    textOutputLeft.setText(outputLeft.listAll());
    labelOutputLeft.setText(outputLeft.size() + " missed defect(s) found.");

    textOutputRight.setStyle("-fx-text-fill: red;");
    textOutputRight.setText(outputRight.listAll());
    labelOutputRight.setText(outputRight.size() + " missed defect(s) found.");

    textOutputCenter.setStyle("-fx-text-fill: green;");
    textOutputCenter.setText(intersect.listAll());
    labelOutputCenter.setText(intersect.size() + " defect(s) covered by both side.");
  }
 @FXML
 private void EstabeleceConexao(ActionEvent event) throws IOException {
   String ip = txtip.getText();
   int port;
   port = (Integer.parseInt(txtport.getText()));
   ClienteConexao conexao = new ClienteConexao(ip, port);
 }
예제 #3
0
  public void confirm(ActionEvent event) {
    String name = nameField.getText();
    if (S.isEmpty(name)) {
      tipsLabel.setText("错误:工具名字不能为空!");
      nameField.requestFocus();
      return;
    }
    String command = commandText.getText();
    String order = orderField.getText();
    ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem();
    Integer parentId = bandeja.getId();
    ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem();
    String type = toolType.getToolType();

    ToolsTray toolsTray = new ToolsTray();
    toolsTray.setTrayName(name);
    toolsTray.setCommand(command);
    toolsTray.setParentId(parentId);
    toolsTray.setToolOrder(order);
    toolsTray.setToolType(type);
    if (null == id) {
      dao.insert(toolsTray);
      id = toolsTray.getId();
      tipsLabel.setText("添加成功:" + name);
    } else {
      toolsTray.setId(id);
      dao.update(toolsTray);
      tipsLabel.setText("更新成功:" + name);
    }
    refresh(null);
  }
  @FXML
  private void onOkButtonClicked() {

    if (!headerTextField.getText().isEmpty() || picturePreview.getImage() != null) {
      HTMLHeader header;
      if (!headerTextField.getText().isEmpty() && picturePreview.getImage() == null) {
        header = new HTMLHeader(headerTextField.getText());
        System.out.println("Header only has text.");
      } else if (headerTextField.getText().isEmpty() && picturePreview.getImage() != null) {
        header = new HTMLHeader(picturePreview.getImage());
        System.out.println("Header only has image.");
      } else {
        header = new HTMLHeader(headerTextField.getText(), picturePreview.getImage());
        System.out.println("Header has both image and text.");
      }

      ApplicationManager.getInstance().setWebPageHeader(header);
      System.out.println("Attempting to set header to webpage.");
      // --------------------Added By James------------------------------------------------
      // JavaToHTML HTML = new JavaToHTML();
      // ApplicationManager.getInstance().getHtmlGenerator().setHeaderFromGUI(headerTextField.getText(),picturePath.getText());
      // writeAndRefresh();
      // --------------------End Added By James------------------------------------------------
    } else {
      System.out.println("Header has nothing. Not creating an object.");
    }
    Stage stage = (Stage) okButton.getScene().getWindow();

    stage.close();
  }
예제 #5
0
  public void storeEntry() {
    Stage window = new Stage();
    Button button;

    Label label = new Label("Please enter the item UPC");
    Label label2 = new Label("Please enter the item's location");

    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle("Save an item");
    window.setWidth(300);
    window.setHeight(400);

    final TextField upcInput = new TextField();
    final TextField locationInput = new TextField();
    button = new Button("Save");
    button.setOnAction(
        e -> {
          try {
            itemUPC = Double.parseDouble(upcInput.getText());
            itemLOC = locationInput.getText();
          } catch (Exception f) {
            displaySimple("Bad input", "Please enter valid inputs");
            status = false;
          }
          window.close();
        });

    VBox layout = new VBox(20);
    layout.getChildren().addAll(label, upcInput, label2, locationInput, button);
    layout.setAlignment(Pos.CENTER);

    Scene scene = new Scene(layout);
    window.setScene(scene);
    window.showAndWait();
  }
예제 #6
0
  @Override
  public Status getStatus() {
    Status status = new Status();

    status.put("id", this.getUUID());
    if (variable != null) {
      status.put("variable", variable.getStatus());
    }

    if (leftVariable != null) {
      status.put("left", leftVariable.getStatus());
    } else if (arg1 != null) {
      status.put("left", arg1.getStatus());
    } else {
      status.put("left", tf1.getText());
    }

    status.put("op", cb.getValue());

    if (arg2 != null) {
      status.put("right", arg2.getStatus());
    } else {
      status.put("right", tf2.getText());
    }

    return status;
  }
예제 #7
0
  @FXML
  void salvar(ActionEvent event) {
    String codigo = txfCodigo.getText();
    String nome = txfNome.getText();

    System.out.println(codigo + "\t" + nome);
  }
 public void StartClicking(ActionEvent actionEvent) {
   var_ammount = 0;
   scene_ClickCount.setText(String.valueOf(var_ammount));
   String var_StringCount = scene_ClickAmmountInput.getText();
   String var_DelayOffset = scene_delay.getText();
   ClickingLogic(Integer.parseInt(var_StringCount), Integer.parseInt(var_DelayOffset));
 }
예제 #9
0
  private void updateTabTitle() {
    final HBox title = new HBox();
    title.setAlignment(Pos.CENTER);

    if (isAutoRefresh()) {
      final ProgressIndicator progressIndicator = new ProgressIndicator();
      progressIndicator.setMaxSize(15, 15);
      title.getChildren().add(progressIndicator);
      title.getChildren().add(new Label(" "));
    }

    // If the search value is too long, show only a substring
    final String searchValue =
        searchField.getText().length() > MAX_SEARCH_VALUE_CHARACTERS
            ? searchField.getText().substring(0, MAX_SEARCH_VALUE_CHARACTERS) + "..."
            : searchField.getText();

    title
        .getChildren()
        .add(
            new Label(
                "Search: \""
                    + searchValue
                    + "\""
                    + " ["
                    + foundMessages.size()
                    + " found / "
                    + seachedCount
                    + " searched]"));

    tab.setText(null);
    tab.setGraphic(title);
  }
  @FXML
  private void onTempModificationButtonClicked(MouseEvent event) throws IOException {
    PreparedStatement statement;
    ResultSet result;
    Connection connection;

    String insertStatement =
        "UPDATE ATRACAO SET DESCRICAO = \'"
            + textArea2.getText()
            + "\', CLASSIFICACAOETARIA = "
            + textField3.getText()
            + ",DATA = TO_DATE(\'"
            + textField6.getText()
            + "\',\'MM/DD/YYYY\')"
            + "WHERE ATRACAO.IDATRACAO = "
            + textField1.getText();
    System.out.println(insertStatement);
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      connection =
          DriverManager.getConnection(
              "jdbc:oracle:thin:@grad.icmc.usp.br:15215:orcl", "7960690", "a");
      System.out.println(insertStatement);
      statement = connection.prepareStatement(insertStatement);
      statement.executeUpdate();

      statement.close();
      connection.close();
      atracoes.get(currentSelectedRow).setDescricao(textArea2.getText());
      atracoes.get(currentSelectedRow).setClassificacaoEtaria(textField3.getText());
      atracoes.get(currentSelectedRow).setData(textField6.getText());
    } catch (SQLException | ClassNotFoundException ex) {
      Logger.getLogger(IncludeTupleController.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  @FXML
  private void calcular() {
    try {

      if (interprete.checarParentesis(txtFuncion.getText())) {
        interprete.setFuncion(txtFuncion.getText());
        if (truncamiento.isSelected()) {
          interprete.setTipoValores(1);
        } else {
          interprete.setTipoValores(2);
        }
        getK();
        txtResultado.setText(
            interprete.getFlotante(new BigDecimal(interprete.getResultado())) + "");
        setOperaciones();
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle("Información");
        alert.setContentText(
            "Error de sintaxis. Verifique que haya escrito la función correctamente");

        alert.showAndWait();
      }
    } catch (Exception e) {
      Alert alert = new Alert(Alert.AlertType.ERROR);
      alert.setTitle("Información");
      alert.setContentText(
          "Error de sintaxis. Verifique que haya escrito la función correctamente");

      alert.showAndWait();
    }
  }
예제 #12
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();
        });
  }
예제 #13
0
 /** Action taken on button click Continue. Creates a player or displays an error. */
 @FXML
 public final void confirmChoices() {
   if (textName.getText().isEmpty()) {
     lblWarning.setText("Please enter a name.");
   } else {
     if (playerCount > 0) {
       // Gets the currently picked color
       final String pickedColor = cmbColor.getValue();
       // Create new player
       final Player tempPlayer =
           new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue());
       main.addPlayer(tempPlayer); // Add new player
       // Remove picked Color from list
       cmbColor.getItems().remove(pickedColor);
       // Sets combo boxes back to zero index
       cmbColor.getSelectionModel().select(0);
       cmbRace.getSelectionModel().select(0);
       textName.clear();
       lblWarning.setText("");
       playerCount--; // Decrement player count after creation
       playerNum++; // Increment player Label number
       lblPlayerNum.setText("Player " + playerNum + ": Choose Your Options");
     } else {
       // If just one player, and end case for last player
       final Player tempPlayer =
           new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue());
       main.addPlayer(tempPlayer);
       // Display the map Screen to start game
       main.showMapScreen();
     }
   }
 }
  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;
  }
예제 #15
0
  public void sendRequest(String username, String password) {

    thisStage = (Stage) logInButton.getScene().getWindow();
    Response res =
        new Request("user/login").set("username", username).set("password", password).send();

    if (res.getSuccess()) {
      Main.setSessionID((String) res.get("sessionID"));
      System.out.println("Login successful.");
      Main.userNotLoggedIn.setValue(false);

      // Save the login option if checked
      if (keepMeLoggedInCheckBox.isSelected()) {
        pc.setProp("username", usernameTextField.getText());
        pc.setProp("password", passwordPasswordField.getText());
        pc.setProp("signInCheckbox", "true");
        pc.saveProps();
      }

      HomeController.userName = usernameTextField.getText();
      thisStage.close();
    } else {
      // incorrect password
    }
  }
  @FXML
  private void handleSaveAction(ActionEvent event) {
    int id = Integer.parseInt(productIDField.getText());
    String name = productNameField.getText();
    String category = productCategoryField.getText();
    double price = Double.parseDouble(unitPriceField.getText());

    Product p = new Product(id, name, category, price);

    try {
      RandomAccessFile output = new RandomAccessFile("product.txt", "rw");
      output.seek(output.length());
      output.writeBytes(p.getId() + "\n");
      output.writeBytes(p.getName() + "\n");
      output.writeBytes(p.getCategory() + "\n");
      output.writeBytes(p.getPrice() + "\n");

      productIDField.setText("");
      productNameField.setText("");
      productCategoryField.setText("");
      unitPriceField.setText("");
    } catch (FileNotFoundException ex) {
      Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
      Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  @FXML
  private void handleNextAction(ActionEvent event) {
    int pr_id = Integer.parseInt(productIDField.getText());
    String pr_name = productNameField.getText();
    String pr_category = productCategoryField.getText();
    double pr_unit_price = Double.parseDouble(unitPriceField.getText());

    Product pr_product = new Product(pr_id, pr_name, pr_category, pr_unit_price);
    if (pr_product != null) {
      try {
        RandomAccessFile input = new RandomAccessFile("product.txt", "r");
        String line;

        for (int i = 0; ; i++) {
          line = input.readLine();
          //                    if (line == null)
          //                        break;
          int id = Integer.parseInt(line);
          line = input.readLine();
          String name = line;
          line = input.readLine();
          String category = line;
          line = input.readLine();
          double price = Double.parseDouble(line);

          Product p = new Product(id, name, category, price);
          products[i] = p;
          if (products[i].getId() == pr_product.getId() && i < products.length) {
            line = input.readLine();
            int next_id = Integer.parseInt(line);
            line = input.readLine();
            String next_name = line;
            line = input.readLine();
            String next_category = line;
            line = input.readLine();
            double next_unit_price = Double.parseDouble(line);
            Product next_product = new Product(next_id, next_name, next_category, next_unit_price);
            products[i + 1] = next_product;
            productIDField.setText(products[i + 1].getId() + "");
            productNameField.setText(products[i + 1].getName());
            productCategoryField.setText(products[i + 1].getCategory());
            unitPriceField.setText(products[i + 1].getPrice() + "");
            break;
          }
          //                    else if(products[0] == pr_product){
          //                        productIDField.setText(products[0].getId() + "");
          //                        productNameField.setText(products[0].getName());
          //                        productCategoryField.setText(products[0].getCategory());
          //                        unitPriceField.setText(products[0].getPrice() + "");
          //                        break;
          //                    }
        }
      } catch (FileNotFoundException ex) {
        Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
      } catch (IOException ex) {
        Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }
예제 #18
0
 // Name Validation method
 private void validateName(TextField input, TextField input1) {
   PlayerOld playerOld = new PlayerOld();
   errorPopUp error = new errorPopUp();
   String inputAge = input1.getText();
   String inputName = input.getText();
   if (inputName.length() == 0) {
     error.errorPop2("Title", "Message");
   } else /*playerOld.*/ validateAge(inputAge, inputName);
 }
예제 #19
0
 // something wrong
 public void changeValue() {
   if (operator.equals("+")) {
     number = Integer.valueOf(text.getText());
     text.setText("-" + number);
     operator = "-";
   } else number = Integer.valueOf(text.getText());
   text.setText("+" + number);
   operator = "+";
 }
  @FXML
  private void HandleLinkButtonAction(ActionEvent event) {
    String link = SourceText.getSelectedText();

    // Create the custom dialog.
    Dialog<Pair<String, String>> dialog = new Dialog<>();
    dialog.setTitle("Détail du lien");
    dialog.setHeaderText("");

    // Set the icon (must be included in the project).
    dialog.setGraphic(
        new ImageView(MainApp.class.getResource("assets/static/icons/link.png").toString()));

    dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

    // Create the username and password labels and fields.
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 150, 10, 10));

    TextField tLink = new TextField();
    tLink.setText(link);
    TextField tLabel = new TextField();
    tLabel.setText(link);

    grid.add(new Label("Lien:"), 0, 0);
    grid.add(tLink, 1, 0);
    grid.add(new Label("Titre du lien"), 0, 1);
    grid.add(tLabel, 1, 1);

    dialog.getDialogPane().setContent(grid);

    // Request focus on the username field by default.
    Platform.runLater(tLink::requestFocus);

    // Convert the result to a username-password-pair when the login button
    // is clicked.
    dialog.setResultConverter(
        dialogButton -> {
          if (dialogButton == ButtonType.OK) {
            return new Pair<>(tLink.getText(), tLabel.getText());
          }
          return null;
        });

    Optional<Pair<String, String>> result = dialog.showAndWait();

    result.ifPresent(
        tLinkTLabel ->
            SourceText.replaceText(
                SourceText.getSelection(),
                "[" + tLinkTLabel.getValue() + "](" + tLinkTLabel.getKey() + ")"));

    SourceText.requestFocus();
  }
예제 #21
0
 private void enviarMensagem() {
   if (!messageInputField.getText().isEmpty()) {
     Thread t =
         new Thread(new SendCommandRunnable(GameCommands.MSG + " " + messageInputField.getText()));
     t.start();
     this.messageInputField.clear();
   } else {
     JOptionPane.showMessageDialog(null, "Campo de texto a ser enviado está vazio.");
   }
 }
예제 #22
0
 /** checks if there are any errors in the values entered by the user */
 private void checkErrors() {
   try {
     Integer.parseInt(borderThickness.getText());
     Integer.parseInt(width.getText());
     Integer.parseInt(height.getText());
     error.setVisible(false); // Only hide the error message if no exceptions were thrown before
   } catch (Exception e) {
     // Don't do anything if an exception is thrown. The error just won't be hidden
   }
 }
예제 #23
0
 // set number to text field
 public void numberButtonClicked(ActionEvent e) {
   if (start) {
     text.setText("0");
     start = false;
   }
   String a;
   a = ((Button) e.getSource()).getText();
   text.setText(text.getText() + a);
   text.positionCaret(text.getText().length());
 }
예제 #24
0
 // Kui vajutad "Lisa", siis lisab järgnevad asjad
 public void lisaButtonVajutatud() {
   Kodut66.Input input = new Kodut66.Input();
   input.setAine(aineInput.getText());
   input.setRuum(Integer.parseInt(ruumInput.getText()));
   input.setDate(dateInput.getText());
   table.getItems().add(input);
   aineInput.clear();
   ruumInput.clear();
   dateInput.clear();
 }
예제 #25
0
 @Override
 public String getValue() {
   String suffix;
   if (stylesheetTf.getText().isEmpty()) {
     return ""; // NOI18N
   } else {
     suffix = stylesheetTf.getText().trim();
   }
   return (new PrefixedValue(itemType, suffix)).toString();
 }
예제 #26
0
  private boolean validateInputs() {
    details = txtDetails.getText();
    value = Double.parseDouble(txtValue.getText());
    date = dpDate.getValue().toString();

    txtDetails.clear();
    txtValue.clear();

    return true;
  }
예제 #27
0
 private SearchMatcher getSearchMatcher() {
   if (defaultSearch.isSelected()) {
     return new SimplePayloadMatcher(searchField.getText(), caseSensitiveCheckBox.isSelected());
   } else if (inlineScriptSearch.isSelected()) {
     return new InlineScriptMatcher(scriptManager, searchField.getText());
   } else {
     final Script script = ((Script) searchMethod.getSelectedToggle().getUserData());
     return new ScriptMatcher(scriptManager, script);
   }
 }
 @FXML
 public void handleDrawBox(ActionEvent e) {
   if (drawBox_row.getText().isEmpty()
       || drawBox_column.getText().isEmpty()
       || drawBox_height.getText().isEmpty()
       || drawBox_width.getText().isEmpty()) {
     JOptionPane.showMessageDialog(null, "Every Field should have a value!");
   } else {
     try {
       ((RemoteOrderDisplay) service)
           .drawBox(
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   drawBox_units.getSelectionModel().getSelectedItem()),
               Integer.parseInt(drawBox_row.getText()),
               Integer.parseInt(drawBox_column.getText()),
               Integer.parseInt(drawBox_height.getText()),
               Integer.parseInt(drawBox_width.getText()),
               Integer.parseInt(drawBox_attribute.getText()),
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   drawBox_borderType.getSelectionModel().getSelectedItem()));
     } catch (NumberFormatException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     } catch (JposException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     }
   }
 }
 @FXML
 public void handleUpdateVideoRegionAttribute(ActionEvent e) {
   if (updateVideoRegionAttribute_row.getText().isEmpty()
       || updateVideoRegionAttribute_col.getText().isEmpty()
       || updateVideoRegionAttribute_height.getText().isEmpty()
       || updateVideoRegionAttribute_width.getText().isEmpty()) {
     JOptionPane.showMessageDialog(null, "Every Field should have a value!");
   } else {
     try {
       ((RemoteOrderDisplay) service)
           .updateVideoRegionAttribute(
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   updateVideoRegionAttribute_units.getSelectionModel().getSelectedItem()),
               RemoteOrderDisplayConstantMapper.getConstantNumberFromString(
                   updateVideoRegionAttribute_function.getSelectionModel().getSelectedItem()),
               Integer.parseInt(updateVideoRegionAttribute_row.getText()),
               Integer.parseInt(updateVideoRegionAttribute_col.getText()),
               Integer.parseInt(updateVideoRegionAttribute_height.getText()),
               Integer.parseInt(updateVideoRegionAttribute_width.getText()),
               Integer.parseInt(updateVideoRegionAttribute_attribute.getText()));
     } catch (NumberFormatException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     } catch (JposException e1) {
       JOptionPane.showMessageDialog(null, e1.getMessage());
       e1.printStackTrace();
     }
   }
 }
예제 #30
0
  private void sendPrivateMessage() {
    String line = receiver.getText() + " " + writePrivateMessage.getText();

    String label = "mail";
    String[] args = line.split(" ");

    this.chatConsoleReader.proccessCommand(label, args);

    this.writePrivateMessage.clear();
    this.receiver.clear();
  }