コード例 #1
0
  public void confirmItem(ActionEvent actionEvent) {
    orderBox.setDisable(true);
    subtotalLabel.setText("Order subtotal for " + myOrders.size() + " items:");
    subtotalBox.setText(String.valueOf(Order.getRunningTotal()));

    if (myOrders.size() < numberOfOrders) {
      IDLabel.setText("Enter Book ID for Item #" + (myOrders.size() + 1) + ":");
      quantityLabel.setText("Enter quantity for Item #" + (myOrders.size() + 1) + ":");
      infoLabel.setText(String.format("Item #%d info", myOrders.size() + 1));

      processBtn.setText(String.format("Process Item #%d", myOrders.size() + 1));
      confirmBtn.setText(String.format("Confirm Item #%d", myOrders.size() + 1));
      processBtn.setDisable(false);
    }

    IDBox.setText("");
    quantityBox.setText("");

    confirmBtn.setDisable(true);
    viewBtn.setDisable(false);
    finishBtn.setDisable(false);
    Alert alert =
        new Alert(
            Alert.AlertType.INFORMATION,
            "Item #" + (myOrders.size()) + " accepted",
            ButtonType.YES);
    alert.show();
  }
コード例 #2
0
  public void newOrder(ActionEvent actionEvent) {
    Order.resetOrder();
    numberOfOrders = 0;
    myOrders = new ArrayList<>();

    processBtn.setDisable(false);
    confirmBtn.setDisable(true);
    viewBtn.setDisable(true);
    finishBtn.setDisable(true);
    orderBox.setDisable(false);

    orderBox.setText("");
    IDBox.setText("");
    quantityBox.setText("");
    infoBox.setText("");
    subtotalBox.setText("");

    IDLabel.setText("Enter Book ID for Item #" + (myOrders.size() + 1) + ":");
    quantityLabel.setText("Enter quantity for Item #" + (myOrders.size() + 1) + ":");
    infoLabel.setText(String.format("Item #%d info", myOrders.size() + 1));

    processBtn.setText(String.format("Process Item #%d", myOrders.size() + 1));
    confirmBtn.setText(String.format("Confirm Item #%d", myOrders.size() + 1));
    subtotalLabel.setText("Order subtotal for " + myOrders.size() + " items:");
  }