final Label message = new Label(); grid.add(message, 1, 7); pwBox.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { if (!pwBox.getText().equals("T2f$Ay!")) { message.setText("Your password is incorrect!"); message.setTextFill(Color.rgb(210, 39, 30)); //Red } else { message.setText("Your password has been confirmed"); message.setTextFill(Color.rgb(21, 117, 84)); //Green } pwBox.clear(); } });
pwBox.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { Label message = new Label(); grid.add(message, 1, 7); message.setText(""); if (!pwBox.getText().equals("T2f$Ay!")) { message.setText("Your password is incorrect!"); message.setTextFill(Color.rgb(210, 39, 30)); //Red } else { message.setText("Your password has been confirmed"); message.setTextFill(Color.rgb(21, 117, 84)); //Green } pwBox.clear(); } });
private Label createDataThresholdLabel(int priorValue, int value) { final Label label = new Label(value + ""); label.setTranslateY(-25); //Move label 25 pixels up label.getStyleClass().addAll("default-color0", "chart-line-symbol", "chart-series-line"); label.setStyle("-fx-font-size: 20; -fx-font-weight: bold;"); if (priorValue == 0) { label.setTextFill(Color.DARKGRAY); } else if (value > priorValue) { label.setTextFill(Color.FORESTGREEN); } else { label.setTextFill(Color.FIREBRICK); } label.setMinSize(Label.USE_PREF_SIZE, Label.USE_PREF_SIZE); return label; }
@Override public void start(Stage primaryStage) { Region content = new Region(); content.setPrefSize(2000, 2000); content.setBackground(new Background(new BackgroundFill( new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(1, Color.BLUE)), CornerRadii.EMPTY, Insets.EMPTY))); Label label = new Label("Hello World!"); label.setTextFill(Color.WHITE); StackPane.setAlignment(label, Pos.TOP_LEFT); StackPane.setMargin(label, new Insets(10)); ScrollPane scrollPane = new ScrollPane(content); StackPane root = new StackPane(); root.getChildren().addAll(scrollPane, label); Scene scene = new Scene(root, 200, 200); primaryStage.setScene(scene); primaryStage.show(); }
private VBox Chat(){ VBox chat = new VBox(); chat.setPrefSize(400, 400); chat.setStyle("-fx-background-color:#333333;"); Label txt1 = new Label("Text1"); txt1.setTextFill(Color.WHITE); txt1.setPrefWidth(400); txt1.setAlignment(Pos.CENTER_LEFT); Label txt2 = new Label("Text2"); txt2.setTextFill(Color.WHITE); txt2.setPrefWidth(400); txt2.setAlignment(Pos.CENTER_RIGHT); chat.getChildren().addAll(txt1,txt2); return chat; }
public void start(Stage primaryStage) { Label label = new Label("Hello World!"); label.setTextFill(Color.WHITE);
heading.setTextFill(Color.BLACK); heading.setUnderline(true); body.setTextFill(Color.RED);
(ov, old_val, new_val) -> { label.setText(new_val); label.setTextFill(Color.web(new_val)); }); stage.show();
Label label = new Label("Drag me", new Rectangle(200, 200, Color.CORNFLOWERBLUE)); label.setContentDisplay(ContentDisplay.CENTER); label.setTextFill(Color.WHITE); label.setAlignment(Pos.CENTER);
caption.setTextFill(Color.DARKORANGE); caption.setStyle("-fx-font: 24 arial;");
label.setTextFill(Color.RED);
caption.setTextFill(Color.DARKORANGE); caption.setStyle("-fx-font: 24 arial;");
label.setTextFill(Color.RED); label.setFont(new Font("Tahoma", 48));
label.setTextFill(Color.RED); label.setFont(new Font("Tahoma", 48));
caption.setTextFill(Color.DARKORANGE); caption.setStyle("-fx-font: 24 arial;"); children.add(caption);
label.setTextFill(Color.BLUE); label.setTextFill(Color.GREEN); label.setTextFill(Color.BLUE); label.setTextFill(Color.BLUE);
label.setTextFill(Color.YELLOW); label.setFont(new Font("Tahoma", 18));
label.setTextFill(Color.RED); label.setFont(new Font("Tahoma", 48));
label.setTextFill(Color.WHITESMOKE);
caption.setTextFill(Color.DARKORANGE); caption.setStyle("-fx-font: 24 arial;");