Java Code Examples for javafx.scene.control.TextField#setMinWidth()
The following examples show how to use
javafx.scene.control.TextField#setMinWidth() .
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: EditingStrStyleCell.java From CPUSim with GNU General Public License v3.0 | 6 votes |
/** * creates a text field with listeners so that that edits will be committed * at the proper time */ protected void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) { if (!arg2) { commitEdit(textField.getText()); } } }); textField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(textField.getText()); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } } }); }
Example 2
Source File: EditingStrCell.java From CPUSim with GNU General Public License v3.0 | 6 votes |
/** * creates a text field with listeners so that that edits will be committed * at the proper time */ protected void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) { if (!arg2) { commitEdit(textField.getText()); } } }); textField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(textField.getText()); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } } }); }
Example 3
Source File: MessAccountantController.java From Hostel-Management-System with MIT License | 6 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(Integer.parseInt(textField.getText())); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } } }); }
Example 4
Source File: EditingStrListCell.java From CPUSim with GNU General Public License v3.0 | 6 votes |
/** * creates a text field with listeners so that that edits will be committed * at the proper time */ protected void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) { if (!arg2) { commitEdit(textField.getText()); } } }); textField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(textField.getText()); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } } }); }
Example 5
Source File: ColorChooser.java From LogFX with GNU General Public License v3.0 | 6 votes |
private static TextField fieldFor( Rectangle colorRectangle, String toolTipText, Consumer<? super Color> onUpdate ) { TextField field = new TextField( colorRectangle.getFill().toString() ); field.setTooltip( new Tooltip( toolTipText ) ); field.setMinWidth( 30 ); field.setMaxWidth( 114 ); field.textProperty().addListener( ( ignore, oldValue, newValue ) -> { try { Color colorValue = Color.valueOf( newValue ); colorRectangle.setFill( colorValue ); field.getStyleClass().remove( "error" ); onUpdate.accept( colorValue ); } catch ( IllegalArgumentException e ) { if ( !field.getStyleClass().contains( "error" ) ) { field.getStyleClass().add( "error" ); } log.debug( "Invalid color entered" ); } } ); return field; }
Example 6
Source File: HighlightOptions.java From LogFX with GNU General Public License v3.0 | 6 votes |
Row( String pattern, Paint backgroundColor, Paint fillColor, boolean isFiltered ) { setSpacing( 5 ); expressionField = new TextField( pattern ); expressionField.setMinWidth( 300 ); expressionField.setTooltip( new Tooltip( "Enter a regular expression." ) ); bkgColorPicker = new ColorChooser( backgroundColor.toString(), "Enter the background color." ); fillColorPicker = new ColorChooser( fillColor.toString(), "Enter the text color." ); isFilteredBox = new CheckBox(); isFilteredBox.setSelected( isFiltered ); isFilteredBox.setTooltip( new Tooltip( "Include in filter" ) ); InvalidationListener updater = ( ignore ) -> update( bkgColorPicker.getColor(), fillColorPicker.getColor(), isFilteredBox.selectedProperty().get() ); bkgColorPicker.addListener( updater ); fillColorPicker.addListener( updater ); isFilteredBox.selectedProperty().addListener( updater ); expressionField.textProperty().addListener( updater ); setMinWidth( 500 ); }
Example 7
Source File: TableAttributeKeyValueTemplateEditingCell.java From Spring-generator with MIT License | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> { if (!arg2) { commitEdit(textField.getText()); } }); }
Example 8
Source File: TableAttributeKeyValueEditingCell.java From Spring-generator with MIT License | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> { if (!arg2) { commitEdit(textField.getText()); } }); }
Example 9
Source File: TableAttributeEntityEditingCell.java From Spring-generator with MIT License | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> { if (!arg2) { commitEdit(textField.getText()); } }); }
Example 10
Source File: ComboBoxTableViewSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.setOnKeyReleased(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(textField.getText()); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } } }); }
Example 11
Source File: ChoiceBoxTableViewSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.setOnKeyReleased(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(textField.getText()); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } } }); }
Example 12
Source File: TableAttributeEntityEditingCell.java From Vert.X-generator with MIT License | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> { if (!arg2) { commitEdit(textField.getText()); } }); }
Example 13
Source File: TableAttributeKeyValueEditingCell.java From Vert.X-generator with MIT License | 5 votes |
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) -> { if (!arg2) { commitEdit(textField.getText()); } }); }
Example 14
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 15
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 16
Source File: CashDepositForm.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private void addHolderNameAndIdForDisplayAccount() { String countryCode = cashDepositAccountPayload.getCountryCode(); if (BankUtil.isHolderIdRequired(countryCode)) { Tuple4<Label, TextField, Label, TextField> tuple = addCompactTopLabelTextFieldTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), BankUtil.getHolderIdLabel(countryCode)); TextField holderNameTextField = tuple.second; holderNameTextField.setText(cashDepositAccountPayload.getHolderName()); holderNameTextField.setMinWidth(300); tuple.fourth.setText(cashDepositAccountPayload.getHolderTaxId()); } else { addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), cashDepositAccountPayload.getHolderName()); } }
Example 17
Source File: CreatorEditingTableCell.java From tcMenu with Apache License 2.0 | 5 votes |
private void buildEditBox(CreatorProperty prop) { TextField textField = new TextField(prop.getLatestValue()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap()* 2); textField.focusedProperty().addListener((ObservableValue<? extends Boolean> o, Boolean old, Boolean newVal) -> { if (!newVal) { commitEdit(textField.getText()); } }); textField.setOnAction(actionEvent -> commitEdit(textField.getText())); editorNode = textField; }
Example 18
Source File: HDF5.java From paintera with GNU General Public License v2.0 | 4 votes |
public GenericBackendDialogN5 backendDialog(ExecutorService propagationExecutor) { final ObjectField<String, StringProperty> containerField = ObjectField.stringField(container.get(), ObjectField.SubmitOn.ENTER_PRESSED, ObjectField.SubmitOn.ENTER_PRESSED); final TextField containerTextField = containerField.textField(); containerField.valueProperty().bindBidirectional(container); containerTextField.setMinWidth(0); containerTextField.setMaxWidth(Double.POSITIVE_INFINITY); containerTextField.setPromptText("HDF5 file"); final Consumer<Event> onClick = event -> { final File initialDirectory = Optional .ofNullable(container.get()) .map(File::new) .map(f -> f.isFile() ? f.getParentFile() : f) .filter(File::exists) .orElse(new File(USER_HOME)); updateFromFileChooser(initialDirectory, containerTextField.getScene().getWindow()); }; final Consumer<String> processSelection = ThrowingConsumer.unchecked(selection -> { LOG.info("Got selection {}", selection); if (selection == null) return; if (isHDF5(selection)) { container.set(selection); return; } updateFromFileChooser(new File(selection), containerTextField.getScene().getWindow()); }); final MenuButton menuButton = BrowseRecentFavorites.menuButton( "_Find", Lists.reverse(PainteraCache.readLines(this.getClass(), "recent")), FAVORITES, onClick::accept, processSelection); GenericBackendDialogN5 d = new GenericBackendDialogN5(containerTextField, menuButton, "N5", writerSupplier, propagationExecutor); final String path = container.get(); if (path != null && new File(path).isFile()) writerSupplier.set(ThrowingSupplier.unchecked(() -> new N5HDF5Writer(path, 64, 64, 64))); return d; }
Example 19
Source File: ZgjedhFolderinRaporti.java From Automekanik with GNU General Public License v3.0 | 4 votes |
public ZgjedhFolderinRaporti(){ stage.setTitle("Zgjedh direktoriumin"); stage.initModality(Modality.APPLICATION_MODAL); stage.setResizable(false); Button btnOk = new Button("Ne rregull"); File file = new File(System.getProperty("user.home") + "/db/raportet.txt"); DirectoryChooser dc = new DirectoryChooser(); dc.setTitle("Zgjedh folderin"); TextField txtPath = new TextField(); Button btnZgjedh = new Button("Zgjedh"); txtPath.setMinWidth(250); try { BufferedReader br = new BufferedReader(new FileReader(file)); txtPath.setText(br.readLine() + ""); if (txtPath.getText().equals("null")) txtPath.setText(""); } catch (Exception e) { e.printStackTrace(); } btnOk.setOnAction(e -> { if (!txtPath.getText().isEmpty()){ try { FileWriter fw = new FileWriter(file); BufferedWriter bw = new BufferedWriter(fw); bw.write(txtPath.getText()); bw.close(); stage.close(); }catch (Exception ex){new Mesazhi("Gabim", "", ex.getMessage());} } }); HBox hbPath = new HBox(5); hbPath.getChildren().addAll(txtPath, btnZgjedh, btnOk); btnZgjedh.setOnAction(e -> { txtPath.setText(dc.showDialog(stage).getPath()); }); GridPane root = new GridPane(); root.add(new Label("Zgjedhni folderin me emrin \"raporti\" i cili permban fajllat me \nprapashtesen \"jrxml\""), 0, 0); root.add(hbPath, 0, 1); root.setAlignment(Pos.CENTER); root.setVgap(5); Scene scene = new Scene(root, 450, 120); scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm()); stage.setScene(scene); stage.show(); }
Example 20
Source File: FileSystem.java From paintera with GNU General Public License v2.0 | 4 votes |
public GenericBackendDialogN5 backendDialog(ExecutorService propagationExecutor) throws IOException { final ObjectField<String, StringProperty> containerField = ObjectField.stringField(container.get(), ObjectField.SubmitOn.ENTER_PRESSED, ObjectField.SubmitOn.ENTER_PRESSED); final TextField containerTextField = containerField.textField(); containerField.valueProperty().bindBidirectional(container); containerTextField.setMinWidth(0); containerTextField.setMaxWidth(Double.POSITIVE_INFINITY); containerTextField.setPromptText("N5 container"); final EventHandler<ActionEvent> onBrowseButtonClicked = event -> { final File initialDirectory = Optional .ofNullable(container.get()) .map(File::new) .filter(File::exists) .filter(File::isDirectory) .orElse(new File(DEFAULT_DIRECTORY)); updateFromDirectoryChooser(initialDirectory, containerTextField.getScene().getWindow()); }; final Consumer<String> processSelection = ThrowingConsumer.unchecked(selection -> { LOG.info("Got selection {}", selection); if (selection == null) return; if (isN5Container(selection)) { container.set(null); container.set(selection); return; } updateFromDirectoryChooser(Paths.get(selection).toFile(), containerTextField.getScene().getWindow()); }); final MenuButton menuButton = BrowseRecentFavorites.menuButton("_Find", Lists.reverse(PainteraCache.readLines(this.getClass(), "recent")), FAVORITES, onBrowseButtonClicked, processSelection); GenericBackendDialogN5 d = new GenericBackendDialogN5(containerTextField, menuButton, "N5", writerSupplier, propagationExecutor); final String path = container.get(); updateWriterSupplier(path); return d; }