Java Code Examples for javafx.scene.control.TextField#setId()
The following examples show how to use
javafx.scene.control.TextField#setId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileSelectionStage.java From marathonv5 with Apache License 2.0 | 6 votes |
private HBox createBrowserField() { HBox browseFieldBox = new HBox(5); dirField = new TextField(); dirField.setId("DirectoryField"); dirField.textProperty().addListener((observable, oldValue, newValue) -> updateOKButton()); HBox.setHgrow(dirField, Priority.ALWAYS); Button browseButton = FXUIUtils.createButton("browse", "Browse directory", true, "Browse"); FileSelectionHandler browserListener; String fileType = fileSelectionInfo.getFileType(); if (fileType != null) { browserListener = new FileSelectionHandler(this, new ExtensionFilter(fileType, Arrays.asList(fileSelectionInfo.getExtensionFilters())), this, null, fileSelectionInfo.getTitle()); } else { browserListener = new FileSelectionHandler(this, null, this, null, fileSelectionInfo.getTitle()); browserListener.setMode(FileSelectionHandler.DIRECTORY_CHOOSER); } browserListener.setPreviousDir(new File(System.getProperty(Constants.PROP_PROJECT_DIR, ProjectLayout.projectDir))); browseButton.setOnAction(browserListener); Label label = createLabel("Name: "); label.setMinWidth(Region.USE_PREF_SIZE); label.setId("FileSelectedLabel"); browseFieldBox.getChildren().addAll(label, dirField, browseButton); VBox.setMargin(browseFieldBox, new Insets(5, 5, 5, 5)); return browseFieldBox; }
Example 2
Source File: BoardNameDialog.java From HubTurbo with GNU Lesser General Public License v3.0 | 6 votes |
protected void setupGrid() { GridPane grid = new GridPane(); setupGridPane(grid); setTitle(BOARD_DIALOG_NAME); HBox nameArea = new HBox(); Text prompt = new Text("New board name: "); nameField = new TextField(DEFAULT_NAME); nameField.setPrefWidth(300); Platform.runLater(() -> { nameField.requestFocus(); }); nameField.setId(IdGenerator.getBoardNameInputFieldId()); nameArea.getChildren().addAll(prompt, nameField); grid.add(nameArea, 0, 0); errorText = new Text(""); errorText.getStyleClass().add("text-red"); grid.add(errorText, 0, 1); getDialogPane().setContent(grid); }
Example 3
Source File: UIFloatMenuItem.java From tcMenu with Apache License 2.0 | 5 votes |
@Override protected int internalInitPanel(GridPane grid, int idx) { idx++; grid.add(new Label("Decimal Places"), 0, idx); decimalPlaces = new TextField(String.valueOf(getMenuItem().getNumDecimalPlaces())); decimalPlaces.textProperty().addListener(this::coreValueChanged); decimalPlaces.setId("decimalPlacesField"); TextFormatterUtils.applyIntegerFormatToField(decimalPlaces); grid.add(decimalPlaces, 1, idx); return idx; }
Example 4
Source File: UIAnalogMenuItem.java From tcMenu with Apache License 2.0 | 5 votes |
@Override protected int internalInitPanel(GridPane grid, int idx) { idx++; grid.add(new Label("Offset from zero"), 0, idx); offsetField = new TextField(String.valueOf(getMenuItem().getOffset())); offsetField.setId("offsetField"); offsetField.textProperty().addListener(this::coreValueChanged); TextFormatterUtils.applyIntegerFormatToField(offsetField); grid.add(offsetField, 1, idx); idx++; grid.add(new Label("Maximum value"), 0, idx); maxValueField = new TextField(String.valueOf(getMenuItem().getMaxValue())); maxValueField.setId("maxValueField"); maxValueField.textProperty().addListener(this::coreValueChanged); TextFormatterUtils.applyIntegerFormatToField(maxValueField); grid.add(maxValueField, 1, idx); idx++; grid.add(new Label("Divisor"), 0, idx); divisorField = new TextField(String.valueOf(getMenuItem().getDivisor())); divisorField.setId("divisorField"); divisorField.textProperty().addListener(this::coreValueChanged); TextFormatterUtils.applyIntegerFormatToField(divisorField); grid.add(divisorField, 1, idx); idx++; grid.add(new Label("Unit name"), 0, idx); unitNameField = new TextField(getMenuItem().getUnitName()); unitNameField.setId("unitNameField"); unitNameField.textProperty().addListener(this::coreValueChanged); grid.add(unitNameField, 1, idx); return idx; }
Example 5
Source File: RubyPathLayout.java From marathonv5 with Apache License 2.0 | 5 votes |
private HBox createRubyHomeField() { HBox rubyHomeBox = new HBox(5); rubyHomeField = new TextField(); rubyHomeField.setId("RubyHomeField"); rubyHomeField.setPromptText("(Bundled JRuby)"); Label label = createLabel("Ruby Home: "); label.setId("RubyLabel"); label.setMinWidth(Region.USE_PREF_SIZE); rubyHomeBox.getChildren().addAll(label, rubyHomeField); HBox.setHgrow(rubyHomeField, Priority.ALWAYS); return rubyHomeBox; }
Example 6
Source File: SettingsDialog.java From mdict-java with GNU General Public License v3.0 | 5 votes |
private HBox make_switchable_path_picker(boolean hasChecker, String message, String val, boolean enabled) { ToggleSwitch switcher = null; if(hasChecker){ switcher = new ToggleSwitch(); switcher.setId(message); switcher.selectedProperty().addListener(this); switcher.setSelected(enabled); } TextField pathInput = new TextField(val); HBox.setHgrow(pathInput, Priority.ALWAYS); pathInput.setId(message); pathInput.textProperty().addListener(this); HBox vb1 = new HBox(new Text(bundle.getString(message)), pathInput); if(switcher!=null){ vb1.getChildren().add(0, switcher); vb1.setPadding(padding); }else{ vb1.setPadding(padding2); } vb1.setAlignment(Pos.CENTER_LEFT); boolean b1,b2; if((b1=message.equals(UI.overwrite_browser)) || message.equals(UI.overwrite_pdf_reader)){//add file-picker if(b1) PathInput1=pathInput; else PathInput2=pathInput; Button btnTmp = new Button(bundle.getString(UI.open)); btnTmp.setId(message); btnTmp.setOnAction(this); vb1.getChildren().add(btnTmp); } return vb1; }
Example 7
Source File: MutableOfferView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) { Label label = new AutoTooltipLabel(labelText); TextField textField = new TextField(value); textField.setMinWidth(500); textField.setEditable(false); textField.setFocusTraversable(false); textField.setId("payment-info"); GridPane.setConstraints(label, 0, row, 1, 1, HPos.RIGHT, VPos.CENTER); GridPane.setConstraints(textField, 1, row); infoGridPane.getChildren().addAll(label, textField); }
Example 8
Source File: TakeOfferView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) { Label label = new AutoTooltipLabel(labelText); TextField textField = new TextField(value); textField.setMinWidth(500); textField.setEditable(false); textField.setFocusTraversable(false); textField.setId("payment-info"); GridPane.setConstraints(label, 0, row, 1, 1, HPos.RIGHT, VPos.CENTER); GridPane.setConstraints(textField, 1, row); infoGridPane.getChildren().addAll(label, textField); }
Example 9
Source File: PanelMenuBar.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
/** * Called in FilterPanel.java when the ShowRenamePanelEventHandler is invoked. * A renameableTextField is generated in which the user inputs the new panel name. */ public void initRenameableTextFieldAndEvents() { renameableTextField = new TextField(); renameableTextField.setId(IdGenerator.getPanelRenameTextFieldId(panel.panelIndex)); Platform.runLater(() -> { renameableTextField.requestFocus(); renameableTextField.selectAll(); }); renameableTextField.setText(panelName); augmentRenameableTextField(); buttonAndKeyboardEventHandler(); renameableTextField.setPrefColumnCount(30); }
Example 10
Source File: MacProtocolView.java From trex-stateless-gui with Apache License 2.0 | 4 votes |
/** * */ @Override protected void buildCustomProtocolView() { addLabel("Destination", 35, 10); addLabel("Source", 75, 10); addLabel("Address", 5, 100); dstAddress = new TextField(); dstAddress.setId("macDstAddress"); addInput(dstAddress, 30, 100, 220); srcAddress = new TextField(); srcAddress.setId("macSrcAddress"); addInput(srcAddress, 72, 100, 220); addLabel("Mode", 5, 330); dstMode = new ComboBox<>(); dstMode.setId("macDstMode"); addCombo(dstMode, 30, 330, 150); srcMode = new ComboBox<>(); srcMode.setId("macsrcMode"); addCombo(srcMode, 70, 330, 150); addLabel("Count", 5, 490); dstCount = new TextField(); addInput(dstCount, 30, 490, 80); srcCount = new TextField(); addInput(srcCount, 70, 490, 80); addLabel("Step", 5, 580); dstStep = new TextField(); addInput(dstStep, 30, 580, 80); srcStep = new TextField(); addInput(srcStep, 70, 580, 80); srcMode.getItems().clear(); dstMode.getItems().clear(); for (MacType type : MacType.values()) { srcMode.getItems().add(type.getTitle()); dstMode.getItems().add(type.getTitle()); } }
Example 11
Source File: BsqAddressTextField.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
public BsqAddressTextField() { TextField textField = new BisqTextField(); textField.setId("address-text-field"); textField.setEditable(false); textField.textProperty().bind(address); String tooltipText = Res.get("addressTextField.copyToClipboard"); textField.setTooltip(new Tooltip(tooltipText)); textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown()); textField.setOnMouseReleased(event -> { if (wasPrimaryButtonDown && address.get() != null && address.get().length() > 0) { Utilities.copyToClipboard(address.get()); Notification walletFundedNotification = new Notification() .notification(Res.get("addressTextField.addressCopiedToClipboard")) .hideCloseButton() .autoClose(); walletFundedNotification.show(); } wasPrimaryButtonDown = false; }); textField.focusTraversableProperty().set(focusTraversableProperty().get()); //TODO app wide focus //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus()); Label copyIcon = new Label(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().addAll("icon", "highlight"); copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard"))); AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> { if (address.get() != null && address.get().length() > 0) Utilities.copyToClipboard(address.get()); })); AnchorPane.setRightAnchor(copyIcon, 5.0); AnchorPane.setRightAnchor(textField, 30.0); AnchorPane.setLeftAnchor(textField, 0.0); getChildren().addAll(textField, copyIcon); }
Example 12
Source File: LoginDialog.java From HubTurbo with GNU Lesser General Public License v3.0 | 4 votes |
@Override protected Parent content() { setTitle(DIALOG_TITLE); setSize(DIALOG_WIDTH, DIALOG_HEIGHT); setStageStyle(StageStyle.UTILITY); GridPane grid = new GridPane(); setupGridPane(grid); Label repoLabel = new Label(LABEL_REPO); grid.add(repoLabel, 0, 0); Label githubLabel = new Label(LABEL_GITHUB); grid.add(githubLabel, 1, 0); repoOwnerField = new TextField(); repoOwnerField.setId(IdGenerator.getLoginDialogOwnerFieldId()); repoOwnerField.setPrefWidth(140); grid.add(repoOwnerField, 2, 0); Label slash = new Label("/"); grid.add(slash, 3, 0); repoNameField = new TextField(); repoNameField.setPrefWidth(250); grid.add(repoNameField, 4, 0); Label usernameLabel = new Label(USERNAME_LABEL); grid.add(usernameLabel, 0, 1); usernameField = new TextField(); grid.add(usernameField, 1, 1, 4, 1); Label passwordLabel = new Label(PASSWORD_LABEL); grid.add(passwordLabel, 0, 2); passwordField = new PasswordField(); grid.add(passwordField, 1, 2, 4, 1); repoOwnerField.setOnAction(e -> login()); repoNameField.setOnAction(e -> login()); usernameField.setOnAction(e -> login()); passwordField.setOnAction(e -> login()); HBox buttons = new HBox(10); buttons.setAlignment(Pos.BOTTOM_RIGHT); loginButton = new Button(BUTTON_SIGN_IN); loginButton.setOnAction(e -> login()); buttons.getChildren().add(loginButton); grid.add(buttons, 4, 3); return grid; }