コード例 #1
1
  public static void setPayPane(int amount) {

    message = new Label(Custom.PAY_PTS_MESSAGE);
    Labels.setLabelStyle(message, Custom.TEXT_SIZE_LARGER, true);
    StackPane.setAlignment(message, Pos.CENTER);

    payBtn = new Button(Custom.YES);
    Buttons.setStoreLargerButtons(payBtn, true);
    StackPane.setAlignment(payBtn, Pos.BOTTOM_LEFT);
    payBtn.setOnAction((ae) -> PayPoints.buy(amount));

    backBtn = new Button(Custom.NO);
    Buttons.setStoreLargerButtons(backBtn, true);
    StackPane.setAlignment(backBtn, Pos.BOTTOM_RIGHT);
    backBtn.setOnAction((ae) -> PayPoints.goBack());

    mainPane = new StackPane();
    mainPane.setStyle(Custom.WINDOW_STYLING);
    mainPane.setMinWidth(Custom.SCREEN_WIDTH * 95 / 100);
    mainPane.setMaxWidth(Custom.SCREEN_WIDTH * 95 / 100);
    mainPane.setMinHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    mainPane.setMaxHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    mainPane.setBorder(
        new Border(
            new BorderStroke(
                Paint.valueOf("#000000"),
                BorderStrokeStyle.SOLID,
                new CornerRadii(30),
                new BorderWidths(5))));
    mainPane.getChildren().addAll(message, payBtn, backBtn);
    mainPane.setPadding(new Insets(10, 10, 10, 10));
    StackPane.setAlignment(mainPane, Pos.CENTER);

    backPane = new StackPane();
    backPane.getChildren().add(mainPane);
    backPane.setStyle(Custom.MENU_BACKGROUND);

    getRoot().getChildren().add(backPane);
  }
コード例 #2
0
  public static void buy(int amount) {

    if (amount <= Choices.getTotal(-1)) {

      Choices.setTotal(-amount);

      Choices.buyItem();

      PayPoints.message(Custom.PURCHASE_DONE, mainPane);

    } else PayPoints.message(Custom.NOT_ENOUGH, mainPane);
  }