コード例 #1
0
 private void setUpStepTextField() {
   Label label = new Label("Podaj krok: ");
   step = new TextField();
   step.setPromptText("Podaj krok");
   GridPane.setMargin(step, new Insets(10, 50, 10, 50));
   GridPane.setMargin(label, new Insets(50, 50, 10, 50));
   gridPane.add(label, 0, 0);
   gridPane.add(step, 0, 1);
 }
コード例 #2
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, CheckBox> addLabelCheckBox(
      GridPane gridPane, int rowIndex, String title, String checkBoxTitle, double top) {
    Label label = addLabel(gridPane, rowIndex, title, -3);
    GridPane.setMargin(label, new Insets(top, 0, 0, 0));

    CheckBox checkBox = new CheckBox(checkBoxTitle);
    GridPane.setRowIndex(checkBox, rowIndex);
    GridPane.setColumnIndex(checkBox, 1);
    GridPane.setMargin(checkBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(checkBox);

    return new Tuple2<>(label, checkBox);
  }
コード例 #3
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
 public static Label addLabel(GridPane gridPane, int rowIndex, String title, double top) {
   Label label = new Label(title);
   GridPane.setRowIndex(label, rowIndex);
   GridPane.setMargin(label, new Insets(top, 0, 0, 0));
   gridPane.getChildren().add(label);
   return label;
 }
コード例 #4
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, TextArea> addLabelTextArea(
      GridPane gridPane, int rowIndex, String title, String prompt, double top) {
    Label label = addLabel(gridPane, rowIndex, title, 0);
    GridPane.setMargin(label, new Insets(top + 4, 0, 0, 0));
    GridPane.setValignment(label, VPos.TOP);

    TextArea textArea = new TextArea();
    textArea.setPromptText(prompt);
    textArea.setWrapText(true);
    GridPane.setRowIndex(textArea, rowIndex);
    GridPane.setColumnIndex(textArea, 1);
    GridPane.setMargin(textArea, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(textArea);

    return new Tuple2<>(label, textArea);
  }
コード例 #5
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
 public static Button addButtonAfterGroup(GridPane gridPane, int rowIndex, String title) {
   Button button = new Button(title);
   button.setDefaultButton(true);
   GridPane.setRowIndex(button, rowIndex);
   GridPane.setColumnIndex(button, 1);
   GridPane.setMargin(button, new Insets(15, 0, 0, 0));
   gridPane.getChildren().add(button);
   return button;
 }
コード例 #6
0
  private void addContent() {
    addMultilineLabel(
        gridPane,
        ++rowIndex,
        "Please use that only in emergency case if you cannot access your fund from the UI.\n"
            + "Before you use this tool, you should backup your data directory. After you have successfully transferred your wallet balance, remove"
            + " the db directory inside the data directory to start with a newly created and consistent data structure.\n"
            + "Please make a bug report on Github so that we can investigate what was causing the problem.",
        10);

    Coin totalBalance = walletService.getAvailableBalance();
    boolean isBalanceSufficient = totalBalance.compareTo(FeePolicy.TX_FEE) >= 0;
    addressTextField =
        addLabelTextField(
                gridPane,
                ++rowIndex,
                "Your available wallet balance:",
                formatter.formatCoinWithCode(totalBalance),
                10)
            .second;
    Tuple2<Label, InputTextField> tuple =
        addLabelInputTextField(gridPane, ++rowIndex, "Your destination address:");
    addressInputTextField = tuple.second;

    emptyWalletButton = new Button("Empty wallet");
    emptyWalletButton.setDefaultButton(isBalanceSufficient);
    emptyWalletButton.setDisable(
        !isBalanceSufficient && addressInputTextField.getText().length() > 0);
    emptyWalletButton.setOnAction(
        e -> {
          if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) {
            if (walletService.getWallet().isEncrypted()) {
              walletPasswordPopup
                  .onClose(() -> blurAgain())
                  .onAesKey(aesKey -> doEmptyWallet(aesKey))
                  .show();
            } else {
              doEmptyWallet(null);
            }
          }
        });

    closeButton = new Button("Cancel");
    closeButton.setOnAction(
        e -> {
          hide();
          closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
        });

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(emptyWalletButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
  }
コード例 #7
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
 public static CheckBox addCheckBox(
     GridPane gridPane, int rowIndex, String checkBoxTitle, double top) {
   CheckBox checkBox = new CheckBox(checkBoxTitle);
   GridPane.setMargin(checkBox, new Insets(top, 0, 0, 0));
   GridPane.setRowIndex(checkBox, rowIndex);
   GridPane.setColumnIndex(checkBox, 1);
   gridPane.getChildren().add(checkBox);
   return checkBox;
 }
コード例 #8
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
 public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top) {
   Label label = new Label(text);
   label.setWrapText(true);
   GridPane.setHalignment(label, HPos.LEFT);
   GridPane.setRowIndex(label, rowIndex);
   GridPane.setColumnSpan(label, 2);
   GridPane.setMargin(label, new Insets(top, 0, 0, 0));
   gridPane.getChildren().add(label);
   return label;
 }
コード例 #9
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, TxIdTextField> addLabelTxIdTextField(
      GridPane gridPane, int rowIndex, String title, double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    TxIdTextField txIdTextField = new TxIdTextField();
    GridPane.setRowIndex(txIdTextField, rowIndex);
    GridPane.setColumnIndex(txIdTextField, 1);
    GridPane.setMargin(txIdTextField, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(txIdTextField);

    return new Tuple2<>(label, txIdTextField);
  }
コード例 #10
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
 public static TitledGroupBg addTitledGroupBg(
     GridPane gridPane, int rowIndex, int rowSpan, String title, double top) {
   TitledGroupBg titledGroupBg = new TitledGroupBg();
   titledGroupBg.setText(title);
   titledGroupBg.prefWidthProperty().bind(gridPane.widthProperty());
   GridPane.setRowIndex(titledGroupBg, rowIndex);
   GridPane.setRowSpan(titledGroupBg, rowSpan);
   GridPane.setColumnSpan(titledGroupBg, 2);
   GridPane.setMargin(titledGroupBg, new Insets(top, -10, -10, -10));
   gridPane.getChildren().add(titledGroupBg);
   return titledGroupBg;
 }
コード例 #11
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, ListView> addLabelListView(
      GridPane gridPane, int rowIndex, String title, double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    ListView listView = new ListView();
    GridPane.setRowIndex(listView, rowIndex);
    GridPane.setColumnIndex(listView, 1);
    GridPane.setMargin(listView, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(listView);

    return new Tuple2<>(label, listView);
  }
コード例 #12
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, TextFieldWithCopyIcon> addLabelTextFieldWithCopyIcon(
      GridPane gridPane, int rowIndex, String title, String value, double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon();
    textFieldWithCopyIcon.setText(value);
    GridPane.setRowIndex(textFieldWithCopyIcon, rowIndex);
    GridPane.setColumnIndex(textFieldWithCopyIcon, 1);
    GridPane.setMargin(textFieldWithCopyIcon, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(textFieldWithCopyIcon);

    return new Tuple2<>(label, textFieldWithCopyIcon);
  }
コード例 #13
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, ComboBox> addLabelComboBox(
      GridPane gridPane, int rowIndex, String title, double top) {
    Label label = null;
    if (title != null) label = addLabel(gridPane, rowIndex, title, top);

    ComboBox comboBox = new ComboBox();
    GridPane.setRowIndex(comboBox, rowIndex);
    GridPane.setColumnIndex(comboBox, 1);
    GridPane.setMargin(comboBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(comboBox);

    return new Tuple2<>(label, comboBox);
  }
コード例 #14
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
 public static Tuple2<Button, Button> add2ButtonsAfterGroup(
     GridPane gridPane, int rowIndex, String title1, String title2, double top) {
   HBox hBox = new HBox();
   hBox.setSpacing(10);
   Button button1 = new Button(title1);
   button1.setDefaultButton(true);
   Button button2 = new Button(title2);
   hBox.getChildren().addAll(button1, button2);
   GridPane.setRowIndex(hBox, rowIndex);
   GridPane.setColumnIndex(hBox, 1);
   GridPane.setMargin(hBox, new Insets(top, 10, 0, 0));
   gridPane.getChildren().add(hBox);
   return new Tuple2<>(button1, button2);
 }
コード例 #15
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple2<Label, TextField> addLabelTextField(
      GridPane gridPane, int rowIndex, String title, String value, double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    TextField textField = new TextField(value);
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);
    GridPane.setRowIndex(textField, rowIndex);
    GridPane.setColumnIndex(textField, 1);
    GridPane.setMargin(textField, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(textField);

    return new Tuple2<>(label, textField);
  }
コード例 #16
0
  private GridPane getSubGrid() {
    subGrid = new GridPane();

    topPane = getTopPane();
    bottomPane = getBottomPane();

    topPane.setPadding(new Insets(50));
    bottomPane.setPadding(new Insets(50));
    subGrid.setPadding(new Insets(0, 100, 0, 100));

    // Css styling
    topPane.getStyleClass().add("TopPaneBorder");
    bottomPane.getStyleClass().add("TopPaneBorder");

    topTitleL.getStyleClass().add("topPaneTitle");
    bottomTitle.getStyleClass().add("topPaneTitle");

    bottomPane.setHgap(10);
    bottomPane.setVgap(5);
    bottomPane.setAlignment(Pos.CENTER_LEFT);

    topPane.setVgap(10);
    topPane.setHgap(10);
    topPane.setAlignment(Pos.CENTER);

    subGrid.setAlignment(Pos.CENTER);
    subGrid.setMargin(topPane, new Insets(10));
    subGrid.setMargin(bottomPane, new Insets(10));

    subGrid.setConstraints(topPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);
    subGrid.setConstraints(bottomPane, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER);

    subGrid.getChildren().addAll(topPane, bottomPane);

    return subGrid;
  }
コード例 #17
0
  private GridPane buildRecordingGrid(Recording recording) {
    GridPane grid = new GridPane();
    grid.setHgap(5);
    grid.setVgap(5);

    Label status = new Label();
    status.setAlignment(Pos.CENTER);
    status.setMinWidth(STATUS_MIN_WIDTH);
    updateStatusIcon(recording, status);
    recording
        .fileExistsActionProperty()
        .addListener(observable -> updateStatusIcon(recording, status));

    Label title = new Label();
    title.setMinWidth(TITLE_MIN_WIDTH);
    title.textProperty().bind(recording.fullTitleProperty());

    Label destination = new Label();
    destination.getStyleClass().add("destination");
    destination.textProperty().bind(recording.destinationProperty().asString());
    LocalDate dateArchived = recording.getDateArchived();
    if (dateArchived != null) {
      String dateArchivedText =
          String.format("Archived %s", DateUtils.formatArchivedOnDate(dateArchived));
      Tooltip tooltip = new Tooltip(dateArchivedText);
      title.setTooltip(tooltip);
      destination.setTooltip(tooltip);
    }

    ReplaceOrRenameActionBar actionBar = new ReplaceOrRenameActionBar(recording, userPrefs);
    actionBar.setMinWidth(ACTION_BAR_MIN_WIDTH);
    GridPane.setHalignment(actionBar, HPos.RIGHT);
    GridPane.setHgrow(actionBar, Priority.ALWAYS);
    GridPane.setMargin(actionBar, new Insets(0, 0, 0, 10));

    grid.add(status, 0, 0, 1, 2);
    grid.add(title, 1, 0);
    grid.add(destination, 1, 1);
    grid.add(actionBar, 2, 0, 1, 2);

    return grid;
  }
コード例 #18
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple3<Label, ComboBox, Button> addLabelComboBoxButton(
      GridPane gridPane, int rowIndex, String title, String buttonTitle, double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    HBox hBox = new HBox();
    hBox.setSpacing(10);

    Button button = new Button(buttonTitle);
    button.setDefaultButton(true);

    ComboBox comboBox = new ComboBox();

    hBox.getChildren().addAll(comboBox, button);

    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(15, 0, 0, 0));
    gridPane.getChildren().add(hBox);

    return new Tuple3<>(label, comboBox, button);
  }
コード例 #19
0
ファイル: FormBuilder.java プロジェクト: rohythakur/bitsquare
  public static Tuple3<Button, ProgressIndicator, Label> addButtonWithStatus(
      GridPane gridPane, int rowIndex, String buttonTitle, double top) {
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    Button button = new Button(buttonTitle);
    button.setDefaultButton(true);

    ProgressIndicator progressIndicator = new ProgressIndicator(0);
    progressIndicator.setPrefHeight(24);
    progressIndicator.setPrefWidth(24);
    progressIndicator.setVisible(false);

    Label label = new Label();
    label.setPadding(new Insets(5, 0, 0, 0));

    hBox.getChildren().addAll(button, progressIndicator, label);

    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);

    return new Tuple3<>(button, progressIndicator, label);
  }
コード例 #20
0
  private void setUpEulerAction() {
    eulerAction = new Button("Dodaj Eulera");
    GridPane.setMargin(eulerAction, new Insets(10, 50, 0, 50));
    gridPane.add(eulerAction, 0, 2);
    eulerAction.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            if (eulerSeries != null) {
              removeSeries(eulerSeries);
              eulerSeries = null;
              eulerAction.setText("Dodaj Eulera");
            } else {
              if (validateText(step.getText())) {
                eulerSeries =
                    EulerGraph.getUniqueInstance(lineChart)
                        .addSeries(Integer.parseInt(step.getText()));
                eulerAction.setText("Usuñ Eulera");
              }
            }
          }
        });
  }
コード例 #21
0
  private void setUpAnaliticAction() {
    analyticAction = new Button("Dodaj analityczna");
    GridPane.setMargin(analyticAction, new Insets(0, 50, 0, 50));
    gridPane.add(analyticAction, 0, 4);
    analyticAction.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            if (analyticSeries != null) {
              removeSeries(analyticSeries);
              analyticSeries = null;
              analyticAction.setText("Dodaj analityczna");
            } else {
              if (validateText(step.getText())) {
                analyticSeries =
                    AnalyticGraph.getUniqueInstance(lineChart)
                        .addSeries(Integer.parseInt(step.getText()));
                analyticAction.setText("Usuñ analityczna");
              }
            }
          }
        });
  }
コード例 #22
0
  private void setUpRKAction() {
    rkAction = new Button("Dodaj Runge Kuttego");
    GridPane.setMargin(rkAction, new Insets(0, 50, 0, 50));
    gridPane.add(rkAction, 0, 3);
    rkAction.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            if (rkSeries != null) {
              removeSeries(rkSeries);
              rkSeries = null;
              rkAction.setText("Dodaj Runge Kuttego");
            } else {
              if (validateText(step.getText())) {
                rkSeries =
                    RKGraph.getUniqueInstance(lineChart)
                        .addSeries(Integer.parseInt(step.getText()));
                rkAction.setText("Usuñ Runge Kuttego");
              }
            }
          }
        });
  }
コード例 #23
0
ファイル: Server_View.java プロジェクト: alenoe/KingOfTokyo
  /**
   * Das GUI besteht aus zwei wesentlichen Komponenten, einer GridPane namens entryArea und einem
   * TextAreaHandler, beide sind in eine BorderPane eingebettet.
   */
  @Override
  protected Scene create_GUI() {

    // ServiceLocator und Translator werden gesetzt.
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();

    // Die MenuBar enthält die Sprachauswahl
    MenuBar menuBar = new MenuBar();
    menuFile = new Menu(t.getString("program.menu.file"));
    menuFileLanguage = new Menu(t.getString("program.menu.file.language"));
    menuFile.getItems().add(menuFileLanguage);

    for (Locale locale : sl.getLocales()) {
      MenuItem language = new MenuItem(locale.getLanguage());
      menuFileLanguage.getItems().add(language);
      language.setOnAction(
          event -> {
            sl.setTranslator(new Translator(locale.getLanguage()));
            updateTexts();
          });
    }

    BorderPane root = new BorderPane();
    root.setPrefSize(409, 219);

    menuBar.getMenus().addAll(menuFile);
    root.setTop(menuBar);

    /**
     * ______________________________________________________________________________________________
     * START OF GRIDPANE !!! ENTRYAREA !!!
     */

    // Serverentry Area
    GridPane entryArea = new GridPane();
    entryArea.setAlignment(Pos.CENTER);
    root.setCenter(entryArea);

    Label lblIP = new Label();
    lblIP.setText("IP: ");
    ;
    lblIP.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblIP, 0, 0);
    GridPane.setMargin(lblIP, new Insets(5, 5, 0, 50));

    Label lblPort = new Label();
    lblPort.setText("Port: ");
    lblPort.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblPort, 0, 1);
    GridPane.setMargin(lblPort, new Insets(5, 5, 0, 50));

    lblHostName = new Label();
    lblHostName.setAlignment(Pos.CENTER_LEFT);
    lblHostName.setId("lblHostName");
    entryArea.add(lblHostName, 0, 2);
    GridPane.setMargin(lblHostName, new Insets(5, 5, 0, 50));

    tfIP = new TextField();
    tfIP.setId("tfIP");
    tfIP.setEditable(false);
    entryArea.add(tfIP, 1, 0);
    GridPane.setMargin(tfIP, new Insets(5, 5, 0, 0));

    tfPort = new TextField();
    tfPort.setId("tfPort");
    tfPort.setText("14000");
    tfPort.setPromptText("Bitte Portnummer eingeben.");
    entryArea.add(tfPort, 1, 1);
    GridPane.setMargin(tfPort, new Insets(5, 5, 0, 0));

    btnStart = new Button();
    btnStart.setId("btnStart");
    btnStart.setText(t.getString("button.start"));
    entryArea.add(btnStart, 2, 0);
    GridPane.setMargin(btnStart, new Insets(5, 5, 0, 50));

    btnClose = new Button();
    btnClose.setId("btnClose");
    btnClose.setText(t.getString("button.close"));
    entryArea.add(btnClose, 2, 1);
    GridPane.setMargin(btnClose, new Insets(5, 5, 0, 50));

    /**
     * ______________________________________________________________________________________________
     * START OF !!! TEXTAREAHANDLER !!!
     */
    textAreaHandler = new TextAreaHandler();
    taLogger = textAreaHandler.getTextArea();
    taLogger.setId("taLogger");
    taLogger.setEditable(false);
    root.setBottom(taLogger);

    Scene scene = new Scene(root);

    return scene;
  }
コード例 #24
0
  private Button createCommandLinksButton(ButtonType buttonType) {
    // look up the CommandLinkButtonType for the given ButtonType
    CommandLinksButtonType commandLink =
        typeMap.getOrDefault(buttonType, new CommandLinksButtonType(buttonType));

    // put the content inside a button
    final Button button = new Button();
    button.getStyleClass().addAll("command-link-button"); // $NON-NLS-1$
    button.setMaxHeight(Double.MAX_VALUE);
    button.setMaxWidth(Double.MAX_VALUE);
    button.setAlignment(Pos.CENTER_LEFT);

    final ButtonData buttonData = buttonType.getButtonData();
    button.setDefaultButton(buttonData != null && buttonData.isDefaultButton());
    button.setOnAction(ae -> setResult(buttonType));

    final Label titleLabel = new Label(commandLink.getButtonType().getText());
    titleLabel
        .minWidthProperty()
        .bind(
            new DoubleBinding() {
              {
                bind(titleLabel.prefWidthProperty());
              }

              @Override
              protected double computeValue() {
                return titleLabel.getPrefWidth() + 400;
              }
            });
    titleLabel.getStyleClass().addAll("line-1"); // $NON-NLS-1$
    titleLabel.setWrapText(true);
    titleLabel.setAlignment(Pos.TOP_LEFT);
    GridPane.setVgrow(titleLabel, Priority.NEVER);

    Label messageLabel = new Label(commandLink.getLongText());
    messageLabel.getStyleClass().addAll("line-2"); // $NON-NLS-1$
    messageLabel.setWrapText(true);
    messageLabel.setAlignment(Pos.TOP_LEFT);
    messageLabel.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(messageLabel, Priority.SOMETIMES);

    Node commandLinkImage = commandLink.getGraphic();
    Node view =
        commandLinkImage == null
            ? new ImageView(
                CommandLinksDialog.class.getResource("arrow-green-right.png").toExternalForm())
            : //$NON-NLS-1$
            commandLinkImage;
    Pane graphicContainer = new Pane(view);
    graphicContainer.getStyleClass().add("graphic-container"); // $NON-NLS-1$
    GridPane.setValignment(graphicContainer, VPos.TOP);
    GridPane.setMargin(graphicContainer, new Insets(0, 10, 0, 0));

    GridPane grid = new GridPane();
    grid.minWidthProperty().bind(titleLabel.prefWidthProperty());
    grid.setMaxHeight(Double.MAX_VALUE);
    grid.setMaxWidth(Double.MAX_VALUE);
    grid.getStyleClass().add("container"); // $NON-NLS-1$
    grid.add(graphicContainer, 0, 0, 1, 2);
    grid.add(titleLabel, 1, 0);
    grid.add(messageLabel, 1, 1);

    button.setGraphic(grid);
    button.minWidthProperty().bind(titleLabel.prefWidthProperty());

    if (commandLink.isHidden) {
      button.setVisible(false);
      button.setPrefHeight(1);
    }
    return button;
  }
コード例 #25
0
  private GridPane getBottomPane() {

    // ======================================= BOTTOM PANE =======================================//

    bottomPane = new GridPane();

    // Labels
    Label underEmployedL = new Label("Under Employed");
    Label otherIncomeL = new Label("Other Income Resource");
    Label typeofOwnershipL = new Label("Ownership");
    Label below8kL = new Label("Below 8,000php");
    Label occupancyL = new Label("Occupancy");
    Label schoolage = new Label("Children in School");

    // Combobox

    underEmployedCBox = new ComboBox(getYesNo());
    otherIncomeCbox = new ComboBox(getYesNo());
    ownershipCbox = new ComboBox(getOwnerShip());
    below8kCbox = new ComboBox(getYesNo());
    occupancyCBox = new ComboBox(getOccupancy());
    childrenSchlCBox = new ComboBox(getChildrenSchool());

    ownershipCbox.setPrefWidth(115);
    childrenSchlCBox.setPrefWidth(115);
    childrenSchlCBox.setDisable(true);
    occupancyCBox.setPrefWidth(115);

    underEmployedCBox.setDisable(true);

    int indexY = 0;

    bottomPane.setConstraints(bottomTitle, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(otherIncomeL, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(otherIncomeCbox, 1, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(below8kL, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(below8kCbox, 1, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(typeofOwnershipL, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(ownershipCbox, 1, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(occupancyL, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(occupancyCBox, 1, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(underEmployedL, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(underEmployedCBox, 1, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(schoolage, 0, indexY, 1, 1, HPos.LEFT, VPos.CENTER);
    bottomPane.setConstraints(childrenSchlCBox, 1, indexY, 1, 1, HPos.LEFT, VPos.CENTER);

    indexY++;
    bottomPane.setConstraints(save, 0, indexY, 2, 1, HPos.CENTER, VPos.CENTER);
    bottomPane.setConstraints(cancel, 1, indexY, 2, 1, HPos.CENTER, VPos.CENTER);

    bottomPane.setMargin(save, new Insets(5, 65, 5, 0));
    bottomPane.setMargin(cancel, new Insets(5, 50, 5, 0));

    addBottomComponentListeners();

    bottomPane
        .getChildren()
        .addAll(
            bottomTitle,
            underEmployedL,
            underEmployedCBox,
            otherIncomeL,
            otherIncomeCbox,
            typeofOwnershipL,
            ownershipCbox,
            below8kL,
            below8kCbox,
            occupancyL,
            occupancyCBox,
            schoolage,
            childrenSchlCBox,
            save,
            cancel);

    return bottomPane;
  }
コード例 #26
0
  @Override
  protected void updateItem(ShoppingItem item, boolean empty) {
    super.updateItem(item, empty);

    if (item != null) {
      if (empty) {
        setText(null);
        setGraphic(null);
      } else {
        setText(null);

        BorderPane pane = new BorderPane();
        pane.setPadding(new Insets(2, 5, 2, 5));
        TextField txtField = new TextField((int) item.getAmount() + "");
        txtField.setMaxWidth(40);
        txtField.setDisable(false);
        txtField.setEditable(true);
        pane.setLeft(txtField);

        Label name = new Label(item.getProduct().getName());
        BorderPane.setAlignment(name, Pos.CENTER_LEFT);
        BorderPane.setMargin(name, new Insets(0, 0, 0, 10));
        name.getStyleClass().add("produktnamn");
        pane.setCenter(name);

        GridPane priceAndDelete = new GridPane();
        double cost = item.getTotal();
        Label price = new Label(String.format("%.2f", cost) + " kr");
        price.setTextAlignment(TextAlignment.CENTER);
        GridPane.setMargin(price, new Insets(0, 10, 0, 0));
        priceAndDelete.add(price, 0, 0);

        Button delete = new Button("X");
        priceAndDelete.add(delete, 1, 0);

        pane.setRight(priceAndDelete);
        setGraphic(pane);

        delete.setOnMouseClicked(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent event) {
                IMatDataHandler.getInstance().getShoppingCart().removeItem(item);
                IMatDataHandler.getInstance()
                    .getShoppingCart()
                    .fireShoppingCartChanged(item, false);
              }
            });

        // Listen for TextField text changes
        txtField
            .textProperty()
            .addListener(
                new ChangeListener<String>() {
                  @Override
                  public void changed(
                      ObservableValue<? extends String> observable,
                      String oldValue,
                      String newValue) {
                    try {
                      if (!txtField.getText().equals("")) {
                        int amount = Integer.parseInt(txtField.getText());
                        if (amount < 1) {
                          txtField.setText(1 + "");
                        } else if (amount > 99) {
                          txtField.setText(99 + "");
                        }
                        item.setAmount(Integer.parseInt(txtField.getText()));
                        double cost2 = item.getTotal();
                        price.setText(String.format("%.2f", cost2) + " kr");
                        // IMatDataHandler.getInstance().getShoppingCart().fireShoppingCartChanged(item, true);
                        lastValidProductAmountString = txtField.getText();
                      }
                    } catch (NumberFormatException e) {
                      txtField.setText(lastValidProductAmountString);
                    }
                  }
                });
      }
    } else {
      if (count < 1) {
        Label noProducts = new Label("Din kundvagn är tom");
        noProducts.getStyleClass().add("produktnamn");
        setGraphic(noProducts);
        count++;
      } else {
        setText(null);
        setGraphic(null);
      }
    }
  }
コード例 #27
0
  public GridPaneSample() {

    VBox vbox = new VBox();

    // grid1 places the child by specifying the rows and columns in
    // GridPane.setContraints()
    Label grid1Caption =
        new Label(
            "The example below shows GridPane content placement by specifying rows and columns:");
    grid1Caption.setWrapText(true);
    GridPane grid1 = new GridPane();
    grid1.setHgap(4);
    grid1.setVgap(6);
    grid1.setPadding(new Insets(18, 18, 18, 18));
    ObservableList<Node> content = grid1.getChildren();

    Label label = new Label("Name:");
    GridPane.setConstraints(label, 0, 0);
    GridPane.setHalignment(label, HPos.RIGHT);
    content.add(label);

    label = new Label("John Q. Public");
    GridPane.setConstraints(label, 1, 0, 2, 1);
    GridPane.setHalignment(label, HPos.LEFT);
    content.add(label);

    label = new Label("Address:");
    GridPane.setConstraints(label, 0, 1);
    GridPane.setHalignment(label, HPos.RIGHT);
    content.add(label);

    label = new Label("12345 Main Street, Some City, CA");
    GridPane.setConstraints(label, 1, 1, 5, 1);
    GridPane.setHalignment(label, HPos.LEFT);
    content.add(label);

    vbox.getChildren().addAll(grid1Caption, grid1, new Separator());

    // grid2 places the child by influencing the rows and columns themselves
    // via GridRowInfo and GridColumnInfo. This grid uses the preferred
    // width/height and max/min width/height.
    Label grid2Caption =
        new Label(
            "The example below shows GridPane content placement by influencing the rows and columns themselves.");
    grid2Caption.setWrapText(true);
    grid2Caption.setWrapText(true);
    GridPane grid2 = new GridPane();
    grid2.setPadding(new Insets(18, 18, 18, 18));
    RowConstraints rowinfo = new RowConstraints(40, 40, 40);
    ColumnConstraints colinfo = new ColumnConstraints(90, 90, 90);

    for (int i = 0; i <= 2; i++) {
      grid2.getRowConstraints().add(rowinfo);
    }

    for (int j = 0; j <= 2; j++) {
      grid2.getColumnConstraints().add(colinfo);
    }

    Label category = new Label("Category:");
    GridPane.setHalignment(category, HPos.RIGHT);
    Label categoryValue = new Label("Wines");
    Label company = new Label("Company:");
    GridPane.setHalignment(company, HPos.RIGHT);
    Label companyValue = new Label("Acme Winery");
    Label rating = new Label("Rating:");
    GridPane.setHalignment(rating, HPos.RIGHT);
    Label ratingValue = new Label("Excellent");

    ImageView imageView = new ImageView(ICON_48);
    GridPane.setHalignment(imageView, HPos.CENTER);

    // Place content
    GridPane.setConstraints(category, 0, 0);
    GridPane.setConstraints(categoryValue, 1, 0);
    GridPane.setConstraints(company, 0, 1);
    GridPane.setConstraints(companyValue, 1, 1);
    GridPane.setConstraints(imageView, 2, 1);
    GridPane.setConstraints(rating, 0, 2);
    GridPane.setConstraints(ratingValue, 1, 2);
    grid2
        .getChildren()
        .addAll(category, categoryValue, company, companyValue, imageView, rating, ratingValue);

    vbox.getChildren().addAll(grid2Caption, grid2, new Separator());

    // grid3 places the child by influencing the rows and columns
    // via GridRowInfo and GridColumnInfo. This grid uses the percentages
    Label grid3Caption =
        new Label(
            "The example below shows GridPane content placement by influencing row and column percentages.  Also, grid lines are made visible in this example.  The lines can be helpful in debugging.");
    grid3Caption.setWrapText(true);
    GridPane grid3 = new GridPane();
    grid3.setPadding(new Insets(18, 18, 18, 18));
    grid3.setGridLinesVisible(true);
    RowConstraints rowinfo3 = new RowConstraints();
    rowinfo3.setPercentHeight(50);

    ColumnConstraints colInfo2 = new ColumnConstraints();
    colInfo2.setPercentWidth(25);

    ColumnConstraints colInfo3 = new ColumnConstraints();
    colInfo3.setPercentWidth(50);

    grid3.getRowConstraints().add(rowinfo3); // 2*50 percent
    grid3.getRowConstraints().add(rowinfo3);

    grid3.getColumnConstraints().add(colInfo2); // 25 percent
    grid3.getColumnConstraints().add(colInfo3); // 50 percent
    grid3.getColumnConstraints().add(colInfo2); // 25 percent

    Label condLabel = new Label(" Member Name:");
    GridPane.setHalignment(condLabel, HPos.RIGHT);
    GridPane.setConstraints(condLabel, 0, 0);
    Label condValue = new Label("MyName");
    GridPane.setMargin(condValue, new Insets(0, 0, 0, 10));
    GridPane.setConstraints(condValue, 1, 0);

    Label acctLabel = new Label("Member Number:");
    GridPane.setHalignment(acctLabel, HPos.RIGHT);
    GridPane.setConstraints(acctLabel, 0, 1);
    TextField textBox = new TextField("Your number");
    GridPane.setMargin(textBox, new Insets(10, 10, 10, 10));
    GridPane.setConstraints(textBox, 1, 1);

    Button button = new Button("Help");
    GridPane.setConstraints(button, 2, 1);
    GridPane.setMargin(button, new Insets(10, 10, 10, 10));
    GridPane.setHalignment(button, HPos.CENTER);

    GridPane.setConstraints(condValue, 1, 0);
    grid3.getChildren().addAll(condLabel, condValue, button, acctLabel, textBox);

    vbox.getChildren().addAll(grid3Caption, grid3);

    getChildren().add(vbox);
  }
コード例 #28
0
  public static void launchForm() {
    loginForm.setTitle("Welcome to GEEK - Log in or Register");
    loginForm.setResizable(false);
    loginForm
        .getIcons()
        .add(new Image(LoginForm.class.getResource("../style_elements/logo.png").toExternalForm()));

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);

    ImageView logo =
        new ImageView((LoginForm.class.getResource("../style_elements/logo.png").toExternalForm()));
    logo.setFitHeight(100);
    logo.setFitWidth(100);
    grid.setMargin(logo, new Insets(0, 0, 0, 72));
    grid.add(logo, 1, 1);

    username.setId("input_field");
    username.setPromptText("Username");
    username.setMinWidth(250);
    username.setFocusTraversable(false);
    grid.add(username, 1, 2);

    password.setId("input_field");
    password.setPromptText("Password");
    password.setMinWidth(250);
    password.setFocusTraversable(false);
    grid.add(password, 1, 3);

    sign_in_button.setId("sign_in_button");
    sign_in_button.setPrefHeight(35);
    sign_in_button.setCursor(Cursor.HAND);

    register_button.setId("register_button");
    register_button.setPrefHeight(35);
    register_button.setCursor(Cursor.HAND);

    HBox buttons = new HBox(10);
    buttons.setAlignment(Pos.CENTER);
    buttons.getChildren().addAll(sign_in_button, register_button);
    grid.add(buttons, 1, 4);

    HBox text = new HBox(3);
    text.setAlignment(Pos.CENTER);
    error_message_field.setFill(Color.WHITE);
    error_message_field.setId("error");
    text.getChildren().add(error_message_field);
    grid.add(text, 1, 6);

    setButtonsActions();

    Scene scene = new Scene(grid, 500, 500);
    scene
        .getStylesheets()
        .add(LoginForm.class.getResource("../style_elements/login_form.css").toExternalForm());
    loginForm.setScene(scene);
    loginForm.show();
    isOpen = true;
  }