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

Source Link

Document

Creates an empty instance of Text.

Usage

From source file:Main.java

static Node reflection() {
    Text t = new Text();
    t.setX(10.0f);/*  ww  w  . jav a 2s .c o  m*/
    t.setY(50.0f);
    t.setCache(true);
    t.setText("Reflections on JavaFX...");
    t.setFill(Color.RED);
    t.setFont(Font.font("null", FontWeight.BOLD, 30));

    Reflection r = new Reflection();
    r.setFraction(0.7f);

    t.setEffect(r);

    t.setTranslateY(400);
    return t;
}

From source file:Main.java

static Node motionBlur() {
    Text t = new Text();
    t.setX(20.0f);//from  w ww  .j  av  a2  s .  c  o m
    t.setY(80.0f);
    t.setText("Motion Blur");
    t.setFill(Color.RED);
    t.setFont(Font.font("null", FontWeight.BOLD, 60));

    MotionBlur mb = new MotionBlur();
    mb.setRadius(15.0f);
    mb.setAngle(45.0f);

    t.setEffect(mb);

    t.setTranslateX(520);
    t.setTranslateY(100);

    return t;
}

From source file:Main.java

static Node lighting() {
    Light.Distant light = new Light.Distant();
    light.setAzimuth(-135.0f);/*from  w w  w.ja  va2 s .co  m*/

    Lighting l = new Lighting();
    l.setLight(light);
    l.setSurfaceScale(5.0f);

    Text t = new Text();
    t.setText("JavaFX\nLighting!");
    t.setFill(Color.RED);
    t.setFont(Font.font("null", FontWeight.BOLD, 70));
    t.setX(500.0f);
    t.setY(100.0f);
    t.setTextOrigin(VPos.TOP);

    t.setEffect(l);

    t.setTranslateX(0);
    t.setTranslateY(320);

    return t;
}

From source file:Main.java

static Node innerShadow() {
    InnerShadow is = new InnerShadow();
    is.setOffsetX(2.0f);// ww  w.  j a  v  a  2  s.  co m
    is.setOffsetY(2.0f);

    Text t = new Text();
    t.setEffect(is);
    t.setX(20);
    t.setY(100);
    t.setText("Inner Shadow");
    t.setFill(Color.RED);
    t.setFont(Font.font("null", FontWeight.BOLD, 80));

    t.setTranslateX(300);
    t.setTranslateY(300);

    return t;
}

From source file:org.sociotech.unui.javafx.engine2d.AbstractWorld.java

private void initFpsText() {
    m_fpsText = new Text();
    m_fpsText.setFont(Font.font(s_TextFontType, s_TextFontSize));
    m_fpsText.setX(getWorldCanvas().getWidth() - s_fpsTextOffsetX);
    m_fpsText.setY(s_fpsTextOffsetY);/*from w  ww.  j  a va2s .c  om*/
    addNode(m_fpsText);
}

From source file:RemoveDuplicateFiles.java

public static Scene makeScene() {
    //Setup the main BorderPane (Holds all the things)
    BorderPane backPane = new BorderPane();

    //----------------------------------------------------------------------
    //Setup the Main Menu Buttons & Pane
    sortFilesButton = new Button("Sort Files");
    batchRenameButton = new Button("Batch Rename Files");

    HBox mainButtons = new HBox();
    mainButtons.setPadding(new Insets(15, 12, 15, 12));
    mainButtons.setSpacing(10);//  ww  w.j a  va  2s  .c  o m
    mainButtons.setStyle(BUTTON_STYLE);

    mainButtons.getChildren().add(sortFilesButton);
    mainButtons.getChildren().add(batchRenameButton);

    backPane.setTop(mainButtons);

    //----------------------------------------------------------------------
    //Setup the filetypes box
    HBox fileTypePane = GUIFactories.getFileTypeBox(fileTypes);
    backPane.setBottom(fileTypePane);

    //----------------------------------------------------------------------
    //Setup the FileType Pre-set Buttons
    VBox preSets = GUIFactories.getPresets(fileTypes);
    backPane.setRight(preSets);

    //----------------------------------------------------------------------
    //Setup the center GridPane
    rmvButton = new Button("Remove Duplicates");
    actionTarget = new Text();

    GridPane grid = GUIFactories.getCenterPane(address, rmvButton, actionTarget);
    backPane.setCenter(grid);

    //----------------------------------------------------------------------
    Scene scene = new Scene(backPane, WIDTH, HEIGHT);
    return scene;

}

From source file:Main.java

static Node displacementMap() {
    int w = 220;//from www  .  ja v  a  2 s.  c  o  m
    int h = 100;
    FloatMap map = new FloatMap();
    map.setWidth(w);
    map.setHeight(h);

    for (int i = 0; i < w; i++) {
        double v = (Math.sin(i / 50.0 * Math.PI) - 0.5) / 40.0;
        for (int j = 0; j < h; j++) {
            map.setSamples(i, j, 0.0f, (float) v);
        }
    }

    Group g = new Group();
    DisplacementMap dm = new DisplacementMap();
    dm.setMapData(map);

    Rectangle r = new Rectangle();
    r.setX(20.0f);
    r.setY(20.0f);
    r.setWidth(w);
    r.setHeight(h);
    r.setFill(Color.BLUE);

    g.getChildren().add(r);

    Text t = new Text();
    t.setX(40.0f);
    t.setY(80.0f);
    t.setText("Wavy Text");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));

    g.getChildren().add(t);

    g.setEffect(dm);
    g.setCache(true);

    g.setTranslateX(400);
    g.setTranslateY(200);

    return g;
}

From source file:Main.java

static Node boxBlur() {
    Text t = new Text();
    t.setText("Blurry Text!");
    t.setFill(Color.RED);/*w  ww  . ja v  a2  s.  c  o m*/
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(10);
    t.setY(40);

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

    t.setEffect(bb);
    t.setTranslateX(300);
    t.setTranslateY(100);

    return t;
}

From source file:Main.java

static Node dropShadow() {
    Group g = new Group();
    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0f);/*from ww w.ja va  2 s .  c o  m*/
    ds.setColor(Color.color(0.4f, 0.4f, 0.4f));

    Text t = new Text();
    t.setEffect(ds);
    t.setCache(true);
    t.setX(10.0f);
    t.setY(270.0f);
    t.setFill(Color.RED);
    t.setText("JavaFX drop shadow...");
    t.setFont(Font.font("null", FontWeight.BOLD, 32));

    DropShadow ds1 = new DropShadow();
    ds1.setOffsetY(4.0f);

    Circle c = new Circle();
    c.setEffect(ds1);
    c.setCenterX(50.0f);
    c.setCenterY(325.0f);
    c.setRadius(30.0f);
    c.setFill(Color.ORANGE);
    c.setCache(true);

    g.getChildren().add(t);
    g.getChildren().add(c);
    return g;
}

From source file:Main.java

static Node bloom() {
    Group g = new Group();

    Rectangle r = new Rectangle();
    r.setX(10);/*from ww  w . j av a2 s .  co  m*/
    r.setY(10);
    r.setWidth(160);
    r.setHeight(80);
    r.setFill(Color.DARKBLUE);

    Text t = new Text();
    t.setText("Bloom!");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(25);
    t.setY(65);

    g.setCache(true);
    //g.setEffect(new Bloom());
    Bloom bloom = new Bloom();
    bloom.setThreshold(1.0);
    g.setEffect(bloom);
    g.getChildren().add(r);
    g.getChildren().add(t);
    g.setTranslateX(350);
    return g;
}