List of usage examples for javafx.scene.text Text Text
public Text(String text)
From source file:Main.java
@Override public void start(Stage stage) { stage.initStyle(StageStyle.UNDECORATED); Text text = new Text("Transparent!"); text.setFont(new Font(40)); VBox box = new VBox(); box.getChildren().add(text);/*from ww w. j a v a 2s .c om*/ final Scene scene = new Scene(box, 300, 250); scene.setFill(null); stage.setScene(scene); stage.show(); scene.setCursor(Cursor.WAIT); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 600, 400); stage.setScene(scene);/*www. j a v a2 s . c om*/ stage.setTitle(""); Text text = new Text("java2s.com"); text.setX(20); text.setY(50); text.setFont(new Font(20)); text.getTransforms().add(new Shear(-0.35, 0)); root.getChildren().add(text); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 600, 400); stage.setScene(scene);//from w ww .j a v a 2 s . co m stage.setTitle("Slider Sample"); Text text = new Text("Using Shear for pseudo-italic font"); text.setX(20); text.setY(50); text.setFont(new Font(20)); text.getTransforms().add(new Shear(-0.35, 0)); root.getChildren().add(text); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Text msg = new Text("java2s.com"); msg.setTextOrigin(VPos.TOP);// w ww. j ava2s. co m msg.setFont(Font.font(24)); Pane root = new Pane(msg); root.setPrefSize(500, 70); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Scrolling Text"); stage.show(); double sceneWidth = scene.getWidth(); double msgWidth = msg.getLayoutBounds().getWidth(); KeyValue initKeyValue = new KeyValue(msg.translateXProperty(), sceneWidth); KeyFrame initFrame = new KeyFrame(Duration.ZERO, initKeyValue); KeyValue endKeyValue = new KeyValue(msg.translateXProperty(), -1.0 * msgWidth); KeyFrame endFrame = new KeyFrame(Duration.seconds(3), endKeyValue); Timeline timeline = new Timeline(initFrame, endFrame); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play(); }
From source file:Main.java
@Override public void start(Stage stage) { Text t1 = new Text("Drop Shadow!"); t1.setFont(Font.font(24));/* w w w .java2 s . c om*/ t1.setEffect(new DropShadow()); Text t2 = new Text("Blur!"); t2.setFont(Font.font(24)); t2.setEffect(new BoxBlur()); Text t3 = new Text("Glow!"); t3.setFont(Font.font(24)); t3.setEffect(new Glow()); Text t4 = new Text("Bloom!"); t4.setFont(Font.font("Arial", FontWeight.BOLD, 24)); t4.setFill(Color.WHITE); t4.setEffect(new Bloom(0.10)); Rectangle rect = new Rectangle(100, 30, Color.GREEN); StackPane spane = new StackPane(rect, t4); HBox root = new HBox(t1, t2, t3, spane); root.setSpacing(20); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Applying Effects"); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 150, Color.GRAY); Line redLine = new Line(10, 10, 200, 10); redLine.setStroke(Color.RED); redLine.setStrokeWidth(10);/*from www .j a v a 2s . co m*/ redLine.setStrokeLineCap(StrokeLineCap.BUTT); redLine.getStrokeDashArray().addAll(10d, 5d, 15d, 5d, 20d); redLine.setStrokeDashOffset(0); root.getChildren().add(redLine); Text offsetText = new Text("Stroke Dash Offset: 0.0"); offsetText.setX(10); offsetText.setY(80); offsetText.setStroke(Color.WHITE); root.getChildren().add(offsetText); Slider slider = new Slider(0, 100, 0); slider.setLayoutX(10); slider.setLayoutY(95); redLine.strokeDashOffsetProperty().bind(slider.valueProperty()); slider.valueProperty().addListener( (ov, curVal, newVal) -> offsetText.setText("Stroke Dash Offset: " + slider.getValue())); root.getChildren().add(slider); primaryStage.setScene(scene); primaryStage.show(); }
From source file:de.pixida.logtest.designer.automaton.ConfigFrame.java
ConfigFrame(final String aTitle) { Validate.notNull(aTitle);/*ww w . j a v a 2 s .com*/ this.title = aTitle; this.setHbarPolicy(ScrollBarPolicy.NEVER); this.setFitToWidth(true); final int insets = 10; this.vbox.setPadding(new Insets(insets)); final int spacing = 8; this.vbox.setSpacing(spacing); final Text titleText = new Text(this.title); final int titleFontSize = 14; titleText.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, titleFontSize)); this.vbox.getChildren().add(titleText); this.setContent(this.vbox); final int minWidth = 200; this.setMinWidth(minWidth); }
From source file:com.github.drbookings.LocalDates.java
public static TextFlow getDateText(final LocalDate date) { final TextFlow tf = new TextFlow(); final Text t0 = new Text(getDateString(date)); tf.getChildren().addAll(t0);/* w w w .j a v a 2s.c o m*/ return tf; }
From source file:de.pixida.logtest.designer.automaton.ConfigFrame.java
void addOption(final String name, final Node control) { final Text nameText = new Text(name + ":"); this.vbox.getChildren().add(nameText); final int marginLeft = 8; VBox.setMargin(control, new Insets(0, 0, 0, marginLeft)); this.vbox.getChildren().add(control); }
From source file:kz.aksay.polygraph.desktop.LoginPane.java
public LoginPane() { GridPane grid = this; grid.setAlignment(Pos.CENTER);/* w ww . j a v a 2 s. co m*/ grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); sceneTitle = new Text(" "); sceneTitle.setId("welcome-text"); grid.add(sceneTitle, 0, 0, 2, 1); userName = new Label(":"); grid.add(userName, 0, 1); userTextField = new TextField(); grid.add(userTextField, 1, 1); password = new Label(":"); grid.add(password, 0, 2); passwordTextBox = new PasswordField(); grid.add(passwordTextBox, 1, 2); signIn = new Button(""); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(signIn); grid.add(hbBtn, 1, 4); final Text actionTarget = new Text(); actionTarget.setId("action-target"); actionTarget.setWrappingWidth(300); grid.add(actionTarget, 0, 6, 2, 1); signIn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (isSignInSuccess()) { onSignInSuccess.handle(e); } else { actionTarget.setText( "? . !"); } } }); }