- Loading...
...
| Anchor | ||||
|---|---|---|---|---|
|
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
@Override
public void start(Stage stage) throws Exception {
String family = "Helvetica";
double size = 20;
Div div = new Div(40, 40);
Span span1 = new Span("Hello ");
span1.setFont(Font.font(family, size));
Span span2 = new Span("Bold");
span2.setFont(Font.font(family, FontWeight.BOLD, size));
Span span3 = new Span(" World");
span3.setFont(Font.font(family, FontPosture.ITALIC, size));
div.getChildren().addAll(span1, span2, span3);
Group group = new Group(div);
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;
Div div = new Div(0, 100);
Span span1 = new Span("Lets have ");
span1.setFont(Font.font(family, size));
Span span2 = new Span("embedded objects: ");
span2.setFont(Font.font(family, FontWeight.BOLD, size));
Rectangle rect = new Rectangle(80, 60);
rect.setFill(null);
rect.setStroke(Color.RED);
Span span3 = new Span(" then button ");
Button button = new Button("click me");
Span span4 = new Span(" finally an image ");
ImageView image = new ImageView("file:///Users/felipe/Documents/felipe/worker.png");
Span span5 = new Span(".");
span5.setFont(Font.font(family, size));
div.getChildren().addAll(span1, span2, rect, span3, button, span4, image, span5);
Scene scene = new Scene(div, 800, 500, Color.WHITE);
div.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;
Div div = new Div();
div.setTranslateX(30);
div.setTranslateY(100);
div.setRotate(45);
Span span1 = new Span("Hello ");
span1.setFont(Font.font(family, size));
Span span2 = new Span("Bold");
span2.setRotate(-45);
span2.setFont(Font.font(family, FontWeight.BOLD, size));
Span span3 = new Span(" World");
span3.setFont(Font.font(family, FontPosture.ITALIC, size));
div.getChildren().addAll(span1, span2, span3);
Group group = new Group(div);
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 {
Div div = new Div();
Font font = new Font("Tahoma", 48);
div.setTextOrigin(VPos.TOP);
Span span1 = new Span("He said \u0627\u0644\u0633\u0644\u0627\u0645");
span1.setFill(Color.RED);
span1.setFont(font);
Span span2 = new Span(" \u0639\u0644\u064a\u0643\u0645 to me.");
span2.setFill(Color.BLUE);
span2.setFont(font);
div.getChildren().addAll(span1, span2);
Group group = new Group(div);
Scene scene = new Scene(group, 500, 500, Color.WHITE);
stage.setTitle("Hello Rich Text");
stage.setScene(scene);
stage.show();
}
|
|