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("size") double size) 

Source Link

Document

Constructs a font using the default face "System".

Usage

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 .  ja  v a  2  s .  co  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) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);/*from  www .j a  va 2 s . com*/
    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);//  w ww.jav  a 2  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 w  w  .ja  va2 s. c om*/
    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) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);/*from   w  w  w  .j  a v a 2  s.c o 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  ww  w. j a  va 2  s.  c  o m
    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(Stage stage) {
    Text msg = new Text("java2s.com");
    msg.setTextOrigin(VPos.TOP);/*ww w.  j  ava 2 s  . c  om*/
    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));
    t1.setEffect(new DropShadow());

    Text t2 = new Text("Blur!");
    t2.setFont(Font.font(24));/*from   w w  w .j a  va2  s .  c om*/
    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:net.gazeplay.commons.utils.License.java

private Text licence(double width, double height) {
    Text text = new Text();

    text.setX(width * 0.1);/*from www. j a  va 2  s. c  o  m*/
    text.setY(height * 0.1);
    text.setFont(new Font(20));

    text.setFill(new Color(1, 1, 1, 1));

    String content = loadLicenseContentAsString();
    text.setText(content);

    return text;

}

From source file:ui.ChoseFonctionnalite.java

private void initUI() {
    Pane root = new Pane();
    root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"),
            BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER,
            new BackgroundSize(530, 400, true, true, true, true))));

    JFXButton serveur = new JFXButton("SERVEUR");
    serveur.setCursor(Cursor.HAND);
    serveur.setMinSize(171, 57);//from ww w  . jav  a 2s .c  o  m
    serveur.setLayoutX(179);
    serveur.setLayoutY(90);
    serveur.setFont(new Font(27));
    serveur.setStyle("-fx-background-color: #9E21FF;");
    serveur.setOnAction(event -> {
        startServerMode();
    });

    JFXButton client = new JFXButton("CLIENT");
    client.setCursor(Cursor.HAND);
    client.setMinSize(171, 57);
    client.setLayoutX(179);
    client.setLayoutY(197);
    client.setFont(new Font(27));
    client.setStyle("-fx-background-color: #9E21FF;");
    client.setOnAction(event -> {
        startClientMode(event);
    });

    Label info = new Label("choisir la maniere d'utiliser virtual remote");
    info.setMinSize(529, 43);
    info.setLayoutX(10);
    info.setLayoutY(14);
    info.setFont(new Font("Algerian", 20));
    root.getChildren().add(client);
    root.getChildren().add(serveur);
    root.getChildren().add(info);
    Scene scene = new Scene(root, 530, 400);
    stage.setTitle("Fontionnalit");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.initStyle(StageStyle.DECORATED);
    stage.setOnCloseRequest(event -> {
        System.exit(1);
    });
    stage.show();
}