TextField field = new TextField(); field.setPromptText("(*.xml, *.java...)");
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class NoFocusTest extends Application { @Override public void start(Stage primaryStage) { TextField tf1 = new TextField(); tf1.setPromptText("Enter something"); TextField tf2 = new TextField(); tf2.setPromptText("Enter something else"); VBox root = new VBox(5, tf1, tf2); primaryStage.setScene(new Scene(root, 250, 150)); primaryStage.show(); root.requestFocus(); } }
TextField txt = new TextField(); txt.setPromptText("Search"); ChangeListener<String> txtListener = (observable, oldValue, newValue) -> System.out.println( "Search text updated to: " + newValue ); txt.textProperty().addListener( txtListener ); txtListener.changed( txt.textProperty(), null, "frobozz" );
TextField textField = new TextField(); textField.setPromptText("Enter text"); PseudoClass empty = PseudoClass.getPseudoClass("empty"); textField.pseudoClassStateChanged(empty, true); textField.textProperty().addListener((obs, oldText, newText) -> { textField.pseudoClassStateChanged(empty, newText.isEmpty()); });
private PopupWindow keyboard; private final Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds(); private final Rectangle2D bounds = Screen.getPrimary().getBounds(); private final double taskbarHeight=bounds.getHeight()-visualBounds.getHeight(); @Override public void start(Stage stage) { TextField tfComment = new TextField(); tfComment.setPromptText("Enter comment"); BorderPane borderPane = new BorderPane(new Button("Click")); borderPane.setBottom(tfComment); Scene scene = new Scene(borderPane); stage.setScene(scene); stage.setX(visualBounds.getMinX()); stage.setY(visualBounds.getMinY()); stage.setWidth(visualBounds.getWidth()); stage.setHeight(visualBounds.getHeight()); stage.show(); }
DatePicker datePicker = new DatePicker(); tf.setPromptText(pattern); lb.setLayoutX(200); lb.setLayoutY(250);
TextField textField = new TextField(); textField.setPromptText("Enter something"); PseudoClass empty = PseudoClass.getPseudoClass("empty"); textField.pseudoClassStateChanged(empty, textField.getText().isEmpty()); textField.textProperty().isEmpty().addListener((obs, wasEmpty, isNowEmpty) -> textField.pseudoClassStateChanged(empty, isNowEmpty));
final List<Row> rows = new ArrayList<>(); addTableField.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { HBox box = new HBox(10); ComboBox<String> combo = new ComboBox<String>(fieldTypes); combo.setPromptText("type"); TextField field = new TextField(); field.setPromptText("field label"); box.getChildren().addAll(field, combo); fieldContainer.getChildren().addAll(box); Row row = new Row(); rows.add(row); row.labelProperty().bind(field.textProperty()); row.typeProperty().bind(combo.valueProperty()); // might need to worry about null values... window.sizeToScene(); } });
from.setPromptText("From"); TextField to = new TextField(); to.setPromptText("To");
TextField t2 = new TextField(); TextField t3 = new TextField(); t1.setPromptText("FirstName"); t2.setPromptText("LastName"); t3.setPromptText("Email"); vBox.getChildren().addAll(new HBox(t1, t2), t3); primaryStage.setScene(new Scene(vBox, 300, 300));
public void start(Stage stage) throws Exception { TextField textField = new TextField(); textField.setPromptText("Drag text here"); textField.addEventHandler( DragEvent.DRAG_OVER,
weeks.setPromptText("How many weeks did you work in the year?"); weeks.setPrefWidth(250); TextField pay = new TextField(); pay.setPromptText("How much does your job pay per hour?"); pay.setPrefWidth(250); TextField hours = new TextField(); hours.setPromptText("How many hours did you work per week on average?"); hours.setPrefWidth(250); TextField bank = new TextField(); bank.setPromptText("What is the percent of the money earned going to your bank account?"); bank.setPrefWidth(250); TextField personal = new TextField(); personal.setPromptText("What is the percent of the money earned going to your own personal use?"); personal.setPrefWidth(250);
public void start(Stage primaryStage) { TextField textField = new TextField(); textField.setPromptText("Enter text");
username.setPromptText("Username"); PasswordField password = new PasswordField(); password.setPromptText("Password");
public void start(Stage primaryStage) { TextField textField = new TextField(); textField.setPromptText("Enter something");
textInput.setPromptText("Enter command");
private VBox addVBox() { VBox vb1 = new VBox(); vb1.setPadding(new Insets(40, 40, 20, 40)); vb1.setSpacing(20); vb1.setStyle("-fx-background-color: #333333;"); TextField txt1 = new TextField(); txt1.setPromptText("Class Number"); txt1.setPrefSize(70, 30); txt1.setFocusTraversable(false); // set focus traversable false. Button b1 = new Button("DELETE"); b1.setFont(Font.font("Calibri", FontWeight.BOLD, 17)); b1.setPrefSize(100, 30); b1.setStyle(" -fx-base: #ffffff;"); b1.setTextFill(Color.BLACK); vb1.getChildren().addAll( txt1, b1); return vb1; }
textField.setPromptText("Tag name - ENTER to add"); textField.setOnKeyPressed(event -> { if (event.getCode() == KeyCode.ENTER) {
public void start(Stage stage) { TextField textField = new TextField(); textField.setPromptText("Enter text to be appended."); Button append = new Button("Append"); append.setDefaultButton(true);
searchField.setPromptText("Search here..");