List of usage examples for javafx.scene.text Text setText
public final void setText(String value)
From source file:de.micromata.mgc.javafx.FXGuiUtils.java
/** * Computes the required height of a text for a given font and a wrapping width. Wrapping width defines when a text * needs to be wrapped if its {@link Label#wrapTextProperty()} is true. * //from w w w . ja v a 2 s . c o m * @param font font of the label. * @param text text to render. * @param wrappingWidth wrapping width. * @return height. */ public static double computeTextHeight(Font font, String text, double wrappingWidth) { final Text helper = new Text(); helper.setText(text); helper.setFont(font); helper.setWrappingWidth((int) wrappingWidth); return helper.getLayoutBounds().getHeight(); }
From source file:Main.java
static Node boxBlur() { Text t = new Text(); t.setText("Blurry Text!"); t.setFill(Color.RED);/*ww w. j a 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 lighting() { Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0f);/*www . ja va 2 s. com*/ 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 bloom() { Group g = new Group(); Rectangle r = new Rectangle(); r.setX(10);/*from w w w . j a v a 2 s.c o 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; }
From source file:Main.java
static Node distantLight() { Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0f);/* w w w.j a va 2 s . co m*/ light.setElevation(30.0f); Lighting l = new Lighting(); l.setLight(light); l.setSurfaceScale(5.0f); final Text t = new Text(); t.setText("Distant Light"); t.setFill(Color.RED); t.setFont(Font.font("null", FontWeight.BOLD, 70)); t.setX(10.0f); t.setY(50.0f); t.setTextOrigin(VPos.TOP); t.setEffect(l); final Rectangle r = new Rectangle(); r.setFill(Color.BLACK); Group g = new Group(); g.getChildren().add(r); g.getChildren().add(t); g.setTranslateY(460); return g; }
From source file:Main.java
static Node motionBlur() { Text t = new Text(); t.setX(20.0f);/*ww w . j a va 2s . c om*/ 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 perspective() { Group g = new Group(); PerspectiveTransform pt = new PerspectiveTransform(); pt.setUlx(10.0f);/*from w w w . java2s .c om*/ pt.setUly(10.0f); pt.setUrx(210.0f); pt.setUry(40.0f); pt.setLrx(210.0f); pt.setLry(60.0f); pt.setLlx(10.0f); pt.setLly(90.0f); g.setEffect(pt); g.setCache(true); Rectangle r = new Rectangle(); r.setX(10.0f); r.setY(10.0f); r.setWidth(280.0f); r.setHeight(80.0f); r.setFill(Color.DARKBLUE); Text t = new Text(); t.setX(20.0f); t.setY(65.0f); t.setText("Perspective"); t.setFill(Color.RED); t.setFont(Font.font("null", FontWeight.BOLD, 36)); g.getChildren().add(r); g.getChildren().add(t); return g; }
From source file:Main.java
static Node innerShadow() { InnerShadow is = new InnerShadow(); is.setOffsetX(2.0f);/*from w w w . ja va2 s. c o 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:Main.java
static Node gaussianBlur() { Text t2 = new Text(); t2.setX(10.0f);/*from w w w . ja va 2 s . c om*/ t2.setY(140.0f); t2.setCache(true); t2.setText("Gaussian Blur"); t2.setFill(Color.RED); t2.setFont(Font.font("null", FontWeight.BOLD, 36)); t2.setEffect(new GaussianBlur()); return t2; }
From source file:Main.java
static Node reflection() { Text t = new Text(); t.setX(10.0f);/*from www .j a v a 2 s . 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; }