Refine search
textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.focusedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (!newValue) { commitEdit(textField.getText());
grid.add(userName, 0, 1); final TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); if (userTextField.getText().equals("")) { usernameValidator.getItems().clear(); usernameValidator.getItems().add( && !userTextField.getText().equals("")) { actiontarget.setFill(Color.GREEN); actiontarget.setText("Welcome");
JFrame frame = new JFrame(); frame.setSize(50, 50); TextField field = new TextField(); field.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // continue from here System.out.println(field.getText()); } @Override public void focusGained(FocusEvent e) { // TODO Auto-generated method stub } }); frame.getContentPane().add(field); frame.setVisible(true);
public String showPrompt(String title, String defValue, final StringProperty result){ // ... final TextField txtPromptValue = new TextField(defValue); // ... btnOk.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent event) { result.set(txtPromptValue.getText()); dlgStage.close(); } }); // ... }
final TextField textField = new TextField(); final PasswordField passwordField = new PasswordField(); final TextField textField1 = new TextField(); ... button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { String hostIP = textField1.getText(); String userName = textField.getText(); String password = passwordField.getText(); isSShConnected = sshManager.connect(hostIP, userName, password); isSFTPConnected = sftpManager.connect(hostIP, userName, password); if(isSFTPConnected && isSShConnected){ System.out.println("Connected"); } } });
private TextField createTextField(String text, String tooltip) { TextField textField = new TextField(text); textField.setTooltip(new Tooltip(tooltip)); textField.setOnAction(event -> { try { int value = Integer.parseInt(textField.getText()); System.out.println(value); } catch (NumberFormatException exc) { System.out.println("Please enter a number"); } }); return textField ; }
TextField fileInput = new TextField(); Button inputButton = new Button("Upload File"); inputButton.disableProperty().bind(Bindings.createBooleanBinding( () -> ! new File(fileInput.getText()).exists(), fileInput.textProperty())); inputButton.setOnAction(e -> { inputFile = new File(fileInput.getText()); window.close(); });
JPanel jPane = new JPanel(); TextField field = new TextField(); jPane.add(field); field.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } }); if (JOptionPane.showConfirmDialog(null,jPane,"Panel Title", JOptionPane.OK_CANCEL_OPTION)== JOptionPane.OK_OPTION) { System.out.println(field.getText()); }
final TextField tf = new TextField(); tf.addEventFilter(KeyEvent.ANY, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (KeyEvent.KEY_TYPED == t.getEventType()) { // put character to the first position tf.setText(t.getCharacter() + tf.getText()); } t.consume(); // doesn't allow TextField to handle keyboard events by itself } });
public class ContentTab extends VBox{ Label allegati; TextField inseriscitesto; ListView<MyObject> view; public ContentTab(int width){ setPadding(new Insets(20)); setSpacing(10); allegati = new Label("Allegati alla lezione"); allegati.setFont(Font.font("Verdana", 13)); inseriscitesto = new TextField(""); FilteredList<MyObject> filteredData = new FilteredList(FXCollections.observableArrayList(), s -> true); view = new ListView<MyObject>(filteredDate); inseriscitesto.textProperty().addListener(obs->{ String filter = inseriscitesto.getText(); if(filter == null || filter.length() == 0) { filteredData.setPredicate(s -> true); } else { filteredData.setPredicate(s -> s.getTitolo().contains(filter)); } }); view.setStyle("-fx-background-color: transparent;"); setPrefWidth(width); getChildren().addAll(allegati,inseriscitesto, view); }
TextField fileInput = new TextField(); Button inputButton = new Button("Upload File"); inputButton.setDisable(true); fileInput.textProperty().addListener((obs, oldText, newText) -> inputButton.setDisable( ! new File(newText).exists() ) ); inputButton.setOnAction(e -> { inputFile = new File(fileInput.getText()); window.close(); });
ListView<String> lv = new ListView<>(); // Make cells editable lv.setEditable(true); lv.setCellFactory(TextFieldListCell.forListView()); // print selected item to the console lv.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { System.out.println("Selected Item: "+ newValue); }); TextField tf = new TextField(); // add new text from the textfield as item to the listview tf.setOnAction((event) -> { lv.getItems().add(tf.getText()); tf.clear(); }); VBox root = new VBox(lv, tf); // TODO: add root to scene