-
Notifications
You must be signed in to change notification settings - Fork 92
/
TextExample.java
49 lines (37 loc) · 1.38 KB
/
TextExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.jenkov.javafx.text;
import javafx.application.Application;
import javafx.geometry.VPos;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontSmoothingType;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class TextExample extends Application {
public static void main(String[] args) {
launch(args);
}
public void start(Stage primaryStage) {
Text text = new Text("This is a JavaFX text. Line 2");
//text.setWrappingWidth(80);
//text.setStrikethrough(true);
//text.setUnderline(true);
text.setFontSmoothingType(FontSmoothingType.GRAY);
text.setFontSmoothingType(FontSmoothingType.LCD);
Text text2 = new Text();
text2.setText("123");
text2.setFont(Font.font("Arial"));
text2.setFont(Font.font("Arial", FontWeight.BOLD, 36));
text.setFill(Color.DARKMAGENTA);
//text.setStroke(Color.GREEN);
text.setX(0);
text.setY(20);
text.setTextOrigin(VPos.BASELINE);
//Scene scene = new Scene(new VBox(text), 300, 250);
Scene scene = new Scene(new Pane(text), 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
}
}