Example usage for javafx.scene.text Text setFont

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

Introduction

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

Prototype

public final void setFont(Font value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Text text = new Text("!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);/*from  w  w  w .  j  a v  a 2 s .  c  o m*/
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
        public void handle(WindowEvent we) {
            System.out.println("Stage is closing");
        }
    });
    stage.close();

}

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 w  w w .  ja  v  a 2  s  . co m
    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, 300, 150);
    stage.setScene(scene);//ww  w  .  j  av a  2s.c o  m
    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) {
    Text text = new Text("Transparent!");
    text.setFont(new Font(40));

    MotionBlur mb = new MotionBlur();
    mb.setRadius(15.0);//from w  w w.  ja  v  a 2 s  .  c om
    mb.setAngle(-30.0);

    text.setEffect(mb);

    VBox box = new VBox();
    box.getChildren().add(text);
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Text t1 = new Text("Drop Shadow!");
    t1.setFont(Font.font(24));
    t1.setEffect(new DropShadow());

    Text t2 = new Text("Blur!");
    t2.setFont(Font.font(24));/*from  w  w w.  j ava2  s .  c o  m*/
    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(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 a  v  a  2  s . c o  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 w w w  .  j a  v a 2  s.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 .java2 s .c  om*/
    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(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 600, 400);
    stage.setScene(scene);//ww w.  ja  v a  2 s  . c o m
    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(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   ww w . j  av  a  2  s  .c om*/

    rootGroup.getChildren().add(text1);

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