TextField unaliasedTextField = new TextField(); unaliasedTextField.setStyle( "-fx-border-width: 0 1 1 1, 1 0 0 0;\n" + "-fx-border-radius: 5, 5;\n" + "-fx-border-color: #0000ff, #0000ff;\n" + "-fx-background-color: #ffffff;" );
TextField textField = new TextField("Sample"); textField.setStyle("" + "-fx-font-size: 30px;" + "-fx-font-style: italic;" + "-fx-font-weight: bold;" + "-fx-font-family: fantasy;" + "-fx-text-fill: blue;" + "-fx-background-color: aqua");
TextField aliasedTextField = new TextField(); aliasedTextField.setStyle( "-fx-border-width: 1;\n" + "-fx-border-radius: 5;\n" + "-fx-border-color: #0000ff;\n" + "-fx-background-color: #ffffff;" );
TextField tf = new TextField("Text"); tf.setStyle(" -fx-text-fill: green");
textField.setStyle(INVALID_STYLE);
import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class TextFieldShadows extends Application { @Override public void start(final Stage stage) throws Exception { TextField standardTextField = new TextField(); TextField styledTextField = new TextField(); styledTextField.setStyle( "-fx-background-color: -fx-text-box-border, -fx-control-inner-background;" ); VBox layout = new VBox(10, standardTextField, styledTextField); layout.setPadding(new Insets(10)); stage.setScene(new Scene(layout)); stage.show(); } public static void main(String[] args) throws Exception { launch(args); } }
public class KeyStroke extends Application { @Override public void start(Stage primaryStage) { Pane root = new Pane(); TextField textField = new TextField("Itachi"); textField.setDisable(true); textField.setStyle("-fx-opacity: 1.0;"); root.getChildren().add(textField); Scene scene = new Scene(root, 200, 200); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
GridPane board = new GridPane(); for (int blockColumn = 0; blockColumn < 3 ; blockColumn++) { for (int blockRow = 0; blockRow < 3; blockRow++) { GridPane box = new GridPane(); box.setStyle("-fx-background-color: black, -fx-control-inner-background; -fx-background-insets: 0, 2; -fx-padding: 2;"); for (int column = 0; column < 3; column++) { for (int row = 0 ; row < 3; row++) { TextField textField = new TextField("0"); textField.setStyle("-fx-pref-width: 2em;"); GridPane.setConstraints(textField, column, row); box.getChildren().add(textField); } } GridPane.setConstraints(box, blockColumn, blockRow); board.getChildren().add(box); } }
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.Pane; import javafx.stage.Stage; public class StyleDemo extends Application { @Override public void start(Stage primaryStage) { TextField txt = new TextField("text"); txt.setLayoutY(150); txt.setPrefHeight(50); txt.setStyle("-fx-background-color: rgb(0,0,0,0.11); -fx-text-fill: white; -fx-font-size: 28; -fx-font-weight: bold"); Pane root = new Pane(); root.setStyle("-fx-background-image: url(\"http://i.stack.imgur.com/ThghN.png\"); -fx-background-repeat: stretch; -fx-background-size: 300 250;"); root.getChildren().add(txt); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
public void start(Stage primaryStage) { TextField txtUser = new TextField(); txtUser.setStyle("-fx-background-color: transparent;-fx-border-color:blue;"); Label txtBG = new Label(" (miles)"); Label labelUser = new Label();
textField = new TextField(text); setContent(content); textField.setStyle("-fx-background-color: transparent"); setGraphic(label); label.setOnMouseClicked((mouseEvent) -> {
for (int row = 0 ; row < 3; row++) { TextField textField = new TextField("0"); textField.setStyle("-fx-pref-width: 2em;"); GridPane.setConstraints(textField, column, row); box.getChildren().add(textField);
final TextField user = new TextField(); TextField demo = new TextField(); user.setStyle("-fx-background-color: transparent;-fx-border-color:blue;"); user.focusedProperty().addListener(new ChangeListener<Boolean>()
textBox.setStyle("-fx-font-size: 34;");
lbl.setAlignment( Pos.CENTER_LEFT ); lbl .setStyle( "-fx-padding:8px; -fx-margin:8px;" ); jpegDir .setStyle( "-fx-padding:8px; -fx-margin:8px;" ); browseBtn.setStyle( "-fx-padding:8px; -fx-margin:8px;" ); topPane.getChildren().addAll( lbl, jpegDir, browseBtn );
lbPlayer1.setTextFill(fontFill); TextField tfPlayer1 = new TextField(player1name); tfPlayer1.setStyle("-fx-background-color: black;" + "-fx-text-fill: lime; -fx-border-color: lime"); tfPlayer1.setPrefWidth(100); lbPlayer2.setTextFill(fontFill); TextField tfPlayer2 = new TextField(player2name); tfPlayer2.setStyle("-fx-background-color: black;" + "-fx-text-fill: lime; -fx-border-color: lime"); tfPlayer2.setPrefWidth(100);