• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. OpenJFX
  3. Main
  4. Discussions
  5. Rich Text
  6. Rich Text API Samples

Page History

Versions Compared

Old Version 9

changes.mady.by.user Brian Beck

Saved on Jan 18, 2013

compared with

New Version Current

changes.mady.by.user Brian Beck

Saved on Jan 18, 2013

  • Previous Change: Difference between versions 8 and 9
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Anchor
sample1
sample1

Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
@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
sample2
sample2

Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
@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
sample3
sample3

Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
@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
sample4
sample4

Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
@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
sample5
sample5

Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
@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
sample6
sample6

Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
@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();
}

...

Overview
Content Tools
ThemeBuilder

Terms of Use • License: GPLv2 • Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Adaptavist ThemeBuilder Powered by Atlassian Confluence 7.4.13
  • Adaptavist ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Adaptavist ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 324, "requestCorrelationId": "358a26434f077751"}