• 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. API Options

Page History

Versions Compared

Old Version 3

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 2 and 3
  • View Page History

Key

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

...

AttributedString
Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
Text text = new Text("Hello Bold World");
TextStyle style = new TextStyle();
Font font = text.getFont();
Font boldFont = Font.font(font.getFamily(), FontWeight.BOLD, font.getSize();
style.setFont(boldFont);
text.setStyle(6, 10, style);
root.getChildren().add(text);
CSS AttributedString
Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
Text text = new Text("Hello Bold World");
TextStyle style = new TextStyle();
style.getStyleClass().add("bold");
text.setStyle(6, 10, style);
root.getChildren().add(text);
scene.getStylesheets().add("file://mysheet.css");

...

In addition, the option to set a class name and id should for a TextStyle should be available:
TextStyle#getStyleClass().add(String className);
TextStyle#setId(String id);

DOM
Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
Paragraph paragraph = new Paragraph();
Text text0 = new Text("Hello ");
Text text1 = new Text("Bold");
Text text2 = new Text(" World");
Font font = paragraph.getFont();
Font boldFont = Font.font(font.getFamily(), FontWeight.BOLD, font.getSize();
text1.setFont(boldFont);
paragraph.getChildren().addAll(text0, text1, text2);
root.getChildren().add(paragraph);
CSS DOM
Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
Paragraph paragraph = new Paragraph();
Text text0 = new Text("Hello ");
Text text1 = new Text("Bold");
Text text2 = new Text(" World");
text1.getStyleClass().add("bold");
paragraph.getChildren().addAll(text0, text1, text2);
root.getChildren().add(paragraph);
scene.getStylesheets().add("file://mysheet.css");

...

AttributedString
Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
Text text = new Text("Hello \uFFFC World");
Image img = new Image("file:///myimage.png");
Font font = text.getFont();
FontMetrics fm = Toolkit.getToolkit().getFontLoader().getFontMetrics(font);
GlyphMetrics gm = new GlyphMetrics()
gm.setDescent(fm.getDescent());
gm.setAscent(img.getHeight() - fm.getDescent());
gm.setWidth(img.getWidth());
TextStyle style = new TextStyle();
style.setGlyphMetrics(gm);
text.setStyle(6, 7, style);
ImageView imgView = new ImageView(img);
root.getChildren().addAll(text, imgView);
//every time a layout happens
Path p = new Path();
p.getElements().addAll(text.impl_getRangeShape(6, 7));
p.setLayoutX(text.getLayoutX());
p.setLayoutY(text.getLayoutY());
Bounds bounds = p.getBoundsInLocal();
double x = bounds.getMinX() + text.getLayoutX();
double y = bounds.getMinY() + text.getLayoutY();
imgView.setLayoutX(x);
imgView.setLayoutY(y);

...

  • This case can't be expressed using CSS with an Attributed String API
  • Image is vertically aligned at the bottom of the text layout
DOM
Code Block
themeEclipse
languagejavathemeEclipse
linenumberstrue
Paragraph paragraph = new Paragraph();
Text text0 = new Text("Hello ");
ImageView imgView = new ImageView();
imgView.getStyleClass().add("imgView1");
Text text2 = new Text(" World");
paragraph.getChildren().addAll(text0, imgView, text2);
root.getChildren().add(paragraph);
scene.getStylesheets().add("file://mysheet2.css");

...

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.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 346, "requestCorrelationId": "db51ca3522b9453d"}