Example usage for javafx.scene.text Text Text

List of usage examples for javafx.scene.text Text Text

Introduction

In this page you can find the example usage for javafx.scene.text Text Text.

Prototype

public Text(double x, double y, String text) 

Source Link

Document

Creates an instance of Text on the given coordinates containing the given string.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(new Text(25, 25, "Hello World!")));

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);//from www  .ja  v a 2s  .  c  om
    stage.sizeToScene();
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);/*w ww .  j ava2s. c om*/
    stage.setTitle("Sample");

    Text t = new Text(10, 50, "This is a test");
    t.setFont(new Font(20));

    root.getChildren().add(t);

    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);//from w ww .  java  2s  .  co m
    stage.setTitle("Sample");

    Text t = new Text(10, 50, "This is a test");
    t.setText("First row\nSecond row");
    t.setFont(new Font(20));

    root.getChildren().add(t);

    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    Group rootGroup = new Group();
    Scene scene = new Scene(rootGroup, 800, 400);

    Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.SERIF, 25));
    rootGroup.getChildren().add(text1);/*from  ww  w  .  j ava 2 s.co m*/

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    Group rootGroup = new Group();
    Scene scene = new Scene(rootGroup, 800, 400);

    Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.MONOSPACED, 35));
    rootGroup.getChildren().add(text1);//from www  .  j a va2s  .c o  m

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);// w w w.j  ava2s.co  m
    stage.setTitle("Sample");

    Text t = new Text(10, 50, "This is a test");
    t.setWrappingWidth(200);
    t.setText("First row Second row Second row Second row Second row Second row ");
    t.setFont(new Font(20));

    root.getChildren().add(t);

    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);//from w w  w  .java2  s .  c  om
    stage.setTitle("Sample");

    Text t = new Text(10, 50, "This is a test");

    t.setTextAlignment(TextAlignment.JUSTIFY);
    t.setText("First row");
    t.setFont(new Font(20));

    root.getChildren().add(t);

    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    Group rootGroup = new Group();
    Scene scene = new Scene(rootGroup, 800, 400);

    Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.MONOSPACED, 35));

    Effect glow = new Glow(1.0);
    text1.setEffect(glow);//from w  ww . java2  s. c o m

    rootGroup.getChildren().add(text1);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    Group rootGroup = new Group();
    Scene scene = new Scene(rootGroup, 800, 400);

    Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.MONOSPACED, 35));

    final Reflection reflection = new Reflection();
    reflection.setFraction(1.0);// w  w w  .  j a  va 2 s  . c  om
    text1.setEffect(reflection);

    rootGroup.getChildren().add(text1);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, Color.web("0x0000FF"));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);//from w  w w  .  j a va 2s .  c  o  m
    text.setFill(Color.RED);
    root.getChildren().add(text);

    primaryStage.setScene(scene);
    primaryStage.show();
}