Example usage for javafx.scene.text Font Font

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

Introduction

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

Prototype

public Font(@NamedArg("name") String name, @NamedArg("size") double size) 

Source Link

Document

Constructs a font using the specified full face name and size

Usage

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);//from  w w  w . ja  v  a  2  s. c  o m
    text1.setEffect(reflection);

    rootGroup.getChildren().add(text1);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//www .j  a  v  a 2 s .c o  m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();

    Hyperlink hpl = new Hyperlink("java2s.com");

    hpl.setFont(Font.font("Arial", 14));

    root.getChildren().addAll(hpl);

    scene.setRoot(root);

    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);

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);//  www. ja  v a2  s  . c  o m
    text.setFill(Color.RED);
    root.getChildren().add(text);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(15);
    bb.setHeight(15);
    bb.setIterations(3);

    text.setEffect(bb);

    primaryStage.setScene(scene);
    primaryStage.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.WHITE);

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

    Reflection refl = new Reflection();
    refl.setFraction(0.8f);
    text.setEffect(refl);

    primaryStage.setScene(scene);
    primaryStage.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 Light.Distant light = new Light.Distant();
    light.setAzimuth(-135.0);//www.  j a  va2s  . com
    final Lighting lighting = new Lighting();
    lighting.setLight(light);
    lighting.setSurfaceScale(9.0);
    text1.setEffect(lighting);

    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", 1.0));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);/*from www  .  jav a  2 s  .com*/
    text.setFill(Color.RED);
    root.getChildren().add(text);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(15);
    bb.setHeight(15);
    bb.setIterations(3);

    text.setEffect(bb);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from   w ww.  ja  va  2s  .co  m
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");
    final Tooltip tooltip = new Tooltip("$ tooltip");
    tooltip.setFont(new Font("Arial", 16));
    cb.setTooltip(tooltip);
    cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            System.out.println(cb.isSelected());
        }
    });

    ((Group) scene.getRoot()).getChildren().add(cb);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*from  w w  w .  j a  va 2s  . c  om*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());
    VBox root = new VBox();

    Hyperlink hpl = new Hyperlink("java2s.com");

    Image image1 = new Image(new File("a.jpg").toURI().toString(), 0, 100, false, false);
    hpl.setFont(Font.font("Arial", 14));
    hpl.setGraphic(new ImageView(image1));
    root.getChildren().addAll(hpl);

    scene.setRoot(root);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Title");

    final Circle circ = new Circle(40, 40, 30);
    final Group root = new Group(circ);

    final Scene scene = new Scene(root, 800, 400, Color.BEIGE);

    final Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.DARKBLUE);
    text1.setFont(Font.font(java.awt.Font.SERIF, 25));
    root.getChildren().add(text1);//from w  w  w . j a  v  a2s .  co  m

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Title");

    final Circle circ = new Circle(40, 40, 30);
    final Group root = new Group(circ);

    final Scene scene = new Scene(root, 800, 400, Color.BEIGE);

    final Text text1 = new Text(25, 25, "java2s.com");
    text1.setFill(Color.CHOCOLATE);
    text1.setFont(Font.font(java.awt.Font.SERIF, 25));
    root.getChildren().add(text1);/*from w  w w.ja  v  a2  s . co m*/

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