- Loading...
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
@Override
public void start(Stage stage) throws Exception {
String family = "Helvetica";
double size = 20;
TextFlow textFlow = new TextFlow();
textFlow.setLayoutX(40);
textFlow.setLayoutY(40);
Text text1 = new Text("Hello ");
text1.setFont(Font.font(family, size));
Text text2 = new Text("Bold");
text2.setFont(Font.font(family, FontWeight.BOLD, size));
Text text3 = new Text(" World");
text3.setFont(Font.font(family, FontPosture.ITALIC, size));
textFlow.getChildren().addAll(text1, text2, text3);
Group group = new Group(textFlow);
Scene scene = new Scene(group, 500, 500, Color.WHITE);
stage.setTitle("Hello Rich Text");
stage.setScene(scene);
stage.show();
}
|
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("Hello Rich Text FXML");
stage.setScene((Scene)FXMLLoader.load(getClass().getResource("hellorichtext.fxml")));
stage.show();
}
|
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("Hello Rich Text FXML");
stage.setScene((Scene)FXMLLoader.load(getClass().getResource("fancy.fxml")));
stage.show();
}
|
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
@Override
public void start(Stage stage) throws Exception {
String family = "Helvetica";
double size = 20;
TextFlow textFlow = new TextFlow();
textFlow.setLayoutX(0);
textFlow.setLayoutY(100);
Text text1 = new Text("Lets have ");
text1.setFont(Font.font(family, size));
Text text2 = new Text("embedded objects: ");
text2.setFont(Font.font(family, FontWeight.BOLD, size));
Rectangle rect = new Rectangle(80, 60);
rect.setFill(null);
rect.setStroke(Color.RED);
Text text3 = new Text(" then button ");
Button button = new Button("click me");
Text text4 = new Text(" finally an image ");
ImageView image = new ImageView("file:///Users/felipe/Documents/felipe/worker.png");
Text text5 = new Text(".");
text5.setFont(Font.font(family, size));
textFlow.getChildren().addAll(text1, text2, rect, text3, button, text4, image, text5);
Scene scene = new Scene(textFlow, 800, 500, Color.WHITE);
textFlow.wrappingWidthProperty().bind(scene.widthProperty());
stage.setTitle("Hello Rich Text with Embedded Objects");
stage.setScene(scene);
stage.show();
}
|
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
@Override
public void start(Stage stage) throws Exception {
String family = "Helvetica";
double size = 20;
TextFlow textFlow = new TextFlow();
textFlow.setTranslateX(30);
textFlow.setTranslateY(100);
textFlow.setRotate(45);
Text text1 = new Text("Hello ");
text1.setFont(Font.font(family, size));
Text text2 = new Text("Bold");
text2.setRotate(-45);
text2.setFont(Font.font(family, FontWeight.BOLD, size));
Text text3 = new Text(" World");
text3.setFont(Font.font(family, FontPosture.ITALIC, size));
textFlow.getChildren().addAll(text1, text2, text3);
Group group = new Group(textFlow);
Scene scene = new Scene(group, 500, 500, Color.WHITE);
stage.setTitle("Hello Rich Text");
stage.setScene(scene);
stage.show();
}
|
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
@Override
public void start(Stage stage) throws Exception {
TextFlow textFlow = new TextFlow();
Font font = new Font("Tahoma", 48);
textFlow.setTextOrigin(VPos.TOP);
Text text1 = new Text("He said \u0627\u0644\u0633\u0644\u0627\u0645");
text1.setFill(Color.RED);
text1.setFont(font);
Text text2 = new Text(" \u0639\u0644\u064a\u0643\u0645 to me.");
text2.setFill(Color.BLUE);
text2.setFont(font);
textFlow.getChildren().addAll(text1, text2);
Group group = new Group(textFlow);
Scene scene = new Scene(group, 500, 500, Color.WHITE);
stage.setTitle("Hello Rich Text");
stage.setScene(scene);
stage.show();
}
|
...