javafx.scene.text.FontWeight Java Examples
The following examples show how to use
javafx.scene.text.FontWeight.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StringBindingSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { Text text = new Text("abc"); text.setTextOrigin(VPos.TOP); text.setLayoutX(10); text.setLayoutY(11); text.setFill(Color.BLACK); text.setOpacity(0.5); text.setFont(Font.font(null, FontWeight.BOLD, 20)); text.setStyle("-fx-font-size: 20px;"); Text text2 = new Text("abc"); text2.setTextOrigin(VPos.TOP); text2.setLayoutX(28); text2.setLayoutY(51); text2.setFill(Color.BLACK); text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20)); text2.setStyle("-fx-font-size: 20px;"); Line line = new Line(30, 32, 45, 57); line.setStroke(Color.DARKMAGENTA); return new javafx.scene.Group(text, line, text2); }
Example #2
Source File: FXGraphics2D.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Sets the font to be used for drawing text. * * @param font the font ({@code null} is permitted but ignored). * * @see #getFont() */ @Override public void setFont(Font font) { if (font == null) { return; } this.font = font; FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL; FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR; this.gc.setFont(javafx.scene.text.Font.font(font.getFamily(), weight, posture, font.getSize())); }
Example #3
Source File: LetterAvatar.java From youtube-comment-suite with MIT License | 6 votes |
private void draw() { Canvas canvas = new Canvas(scale, scale); GraphicsContext gc = canvas.getGraphicsContext2D(); gc.setFill(Color.TRANSPARENT); gc.fillRect(0, 0, scale, scale); gc.setFill(background); gc.fillRect(0, 0, scale, scale); gc.setFill(Color.WHITE); gc.setTextAlign(TextAlignment.CENTER); gc.setTextBaseline(VPos.CENTER); gc.setFont(Font.font("Tahoma", FontWeight.SEMI_BOLD, scale * 0.6)); gc.fillText(String.valueOf(character), Math.round(scale / 2.0), Math.round(scale / 2.0)); Platform.runLater(() -> canvas.snapshot(null, this)); }
Example #4
Source File: HistoryListPopup.java From arma-dialog-creator with MIT License | 6 votes |
public HistoryListItemNode(@NotNull HistoryListItem item) { super(5); final VBox vboxTitle = new VBox(5); final Label lblTitle = new Label(item.getItemTitle()); lblTitle.setFont(Font.font(15)); vboxTitle.getChildren().add(lblTitle); Font subInfoLabelFont = Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 10); Font subInfoTextFont = Font.font(subInfoLabelFont.getSize()); for (HistoryListItemSubInfo subInfo : item.getSubInfo()) { final Label lbl = new Label(subInfo.getLabel()); lbl.setFont(subInfoLabelFont); final Label lblInfo = new Label(subInfo.getInfo()); lblInfo.setFont(subInfoTextFont); vboxTitle.getChildren().add(new HBox(5, lbl, lblInfo)); } getChildren().add(vboxTitle); final Label lblMainInfo = new Label(item.getInformation()); lblMainInfo.setWrapText(true); getChildren().add(lblMainInfo); }
Example #5
Source File: FXGraphics2D.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Sets the font to be used for drawing text. * * @param font the font ({@code null} is permitted but ignored). * * @see #getFont() */ @Override public void setFont(Font font) { if (font == null) { return; } this.font = font; FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL; FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR; this.gc.setFont(javafx.scene.text.Font.font(font.getFamily(), weight, posture, font.getSize())); }
Example #6
Source File: MapPane.java From FXMaps with GNU Affero General Public License v3.0 | 6 votes |
/** * Called internally to configure size, position and style of the overlay. */ private void configureOverlay() { dimmer = new StackPane(); dimmer.setManaged(false); dimmerMessage = new Label(DEFAULT_OVERLAY_MESSAGE); dimmerMessage.setFont(Font.font(dimmerMessage.getFont().getFamily(), FontWeight.BOLD, 18)); dimmerMessage.setTextFill(Color.WHITE); dimmer.getChildren().add(dimmerMessage); dimmer.setStyle("-fx-background-color: rgba(0, 0, 0, 0.6);"); getChildren().add(dimmer); layoutBoundsProperty().addListener((v, o, n) -> { Platform.runLater(() -> { if(MapPane.this.getScene().getWindow() == null) return; Point2D mapPoint = contentPane.localToParent(0, 0); double topHeight = contentPane.getTop() == null ? 0 : contentPane.getTop().getLayoutBounds().getHeight(); dimmer.resizeRelocate(mapPoint.getX(), mapPoint.getY() + topHeight, contentPane.getWidth(), contentPane.getHeight() - topHeight); }); }); }
Example #7
Source File: FXGraphics2D.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Sets the font to be used for drawing text. * * @param font the font ({@code null} is permitted but ignored). * * @see #getFont() */ @Override public void setFont(Font font) { if (font == null) { return; } this.font = font; FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL; FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR; this.gc.setFont(javafx.scene.text.Font.font(font.getFamily(), weight, posture, font.getSize())); }
Example #8
Source File: AttributeCalculatorPane.java From constellation with Apache License 2.0 | 6 votes |
private void updateAttributeDescriptionHelp(String attributeName, String attributeDescription, String attributeType) { Platform.runLater(() -> { attributeDescriptionHelp.getChildren().clear(); final Text attributeHeadingText = new Text("Attribute to set:\n"); attributeHeadingText.setFont(Font.font(FONT_FAMILY, FontWeight.NORMAL, 16)); attributeHeadingText.setFill(Color.web(TEXT_COLOR)); final Text attributeLabelText = new Text(attributeName); attributeLabelText.setFont(Font.font(FONT_FAMILY, FontWeight.BOLD, 12)); attributeLabelText.setFill(Color.WHITE); final Text attributeSpacingText = new Text(" - "); attributeSpacingText.setFont(Font.font(FONT_FAMILY, FontWeight.NORMAL, 12)); attributeSpacingText.setFill(Color.WHITE); final Text attributeDescriptionText = new Text(attributeDescription); attributeDescriptionText.setFont(Font.font(FONT_FAMILY, FontPosture.ITALIC, 12)); attributeDescriptionText.setFill(Color.WHITE); final Text attributeTypeText = new Text(" (type: " + attributeType + ")"); attributeTypeText.setFont(Font.font(FONT_FAMILY, FontWeight.NORMAL, 12)); attributeTypeText.setFill(Color.WHITE); attributeDescriptionHelp.getChildren().addAll(attributeHeadingText, attributeLabelText, attributeSpacingText, attributeDescriptionText, attributeTypeText); }); }
Example #9
Source File: XMLPersistence.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Load font from XML document * @param node Parent node of the color * @param font_tag Name of tag that contains the font * @return {@link Font} */ public static Optional<Font> loadFontFromDocument(final Element node, final String font_tag) { final String desc = XMLUtil.getChildString(node, font_tag).orElse(""); if (desc.isEmpty()) return Optional.empty(); String family = DEFAULT_FONT_FAMILY; FontPosture posture = FontPosture.REGULAR; FontWeight weight = FontWeight.NORMAL; double size = DEFAULT_FONT_SIZE; // Legacy format was "Liberation Sans|20|1" final String[] items = desc.split("\\|"); if (items.length == 3) { family = items[0]; size = Double.parseDouble(items[1]); switch (items[2]) { case "1": // SWT.BOLD weight = FontWeight.BOLD; break; case "2": // SWT.ITALIC posture = FontPosture.ITALIC; break; case "3": // SWT.BOLD | SWT.ITALIC weight = FontWeight.BOLD; posture = FontPosture.ITALIC; break; } } return Optional.of(Font.font(family, weight, posture, size )); }
Example #10
Source File: App.java From java-ml-projects with Apache License 2.0 | 6 votes |
private Parent buildUI() { fc = new FileChooser(); fc.getExtensionFilters().clear(); ExtensionFilter jpgFilter = new ExtensionFilter("JPG, JPEG images", "*.jpg", "*.jpeg", "*.JPG", ".JPEG"); fc.getExtensionFilters().add(jpgFilter); fc.setSelectedExtensionFilter(jpgFilter); fc.setTitle("Select a JPG image"); lstLabels = new ListView<>(); lstLabels.setPrefHeight(200); Button btnLoad = new Button("Select an Image"); btnLoad.setOnAction(e -> validateUrlAndLoadImg()); HBox hbBottom = new HBox(10, btnLoad); hbBottom.setAlignment(Pos.CENTER); loadedImage = new ImageView(); loadedImage.setFitWidth(300); loadedImage.setFitHeight(250); Label lblTitle = new Label("Label image using TensorFlow"); lblTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 40)); VBox root = new VBox(10,lblTitle, loadedImage, new Label("Results:"), lstLabels, hbBottom); root.setAlignment(Pos.TOP_CENTER); return root; }
Example #11
Source File: DropShadowSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public DropShadowSample() { Text sample = new Text(0,40,"DropShadow Effect"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36)); final DropShadow dropShadow = new DropShadow(); sample.setEffect(dropShadow); getChildren().add(sample); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d), new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d), new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d), new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty()) ); // END REMOVE ME }
Example #12
Source File: FXGraphics2D.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Sets the font to be used for drawing text. * * @param font the font ({@code null} is permitted but ignored). * * @see #getFont() */ @Override public void setFont(Font font) { if (font == null) { return; } this.font = font; FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL; FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR; this.gc.setFont(javafx.scene.text.Font.font(font.getFamily(), weight, posture, font.getSize())); }
Example #13
Source File: FXGraphics2D.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Sets the font to be used for drawing text. * * @param font the font ({@code null} is permitted but ignored). * * @see #getFont() */ @Override public void setFont(Font font) { if (font == null) { return; } this.font = font; FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL; FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR; this.gc.setFont(javafx.scene.text.Font.font(font.getFamily(), weight, posture, font.getSize())); }
Example #14
Source File: HTMLEditorSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { Text htmlStart = new Text("<html>"); Text htmlEnd = new Text("</html>"); htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20)); htmlStart.setStyle("-fx-font-size: 20px;"); htmlStart.setTextOrigin(VPos.TOP); htmlStart.setLayoutY(11); htmlStart.setLayoutX(20); htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20)); htmlEnd.setStyle("-fx-font-size: 20px;"); htmlEnd.setTextOrigin(VPos.TOP); htmlEnd.setLayoutY(31); htmlEnd.setLayoutX(20); return new Group(htmlStart, htmlEnd); }
Example #15
Source File: StatusBar.java From marathonv5 with Apache License 2.0 | 6 votes |
public StatusBar() { setId("status-bar"); msgLabel = createLabel(""); extraLabel = createLabel(" "); extraLabel.setFont(Font.font("System", FontPosture.ITALIC, 12.0)); fixtureLabel = createLabel(" "); fixtureLabel.setFont(Font.font("System", FontWeight.BOLD, 12.0)); rowLabel = createLabel(" "); columnLabel = createLabel(" "); insertLabel = createLabel(" "); Region region = new Region(); getChildren().addAll(msgLabel, region, createSeparator(), extraLabel, createSeparator(), fixtureLabel, createSeparator(), rowLabel, createSeparator(), columnLabel, createSeparator(), insertLabel, createSeparator()); HBox.setHgrow(region, Priority.ALWAYS); getStylesheets().add(ModalDialog.class.getClassLoader().getResource("net/sourceforge/marathon/fx/api/css/marathon.css") .toExternalForm()); }
Example #16
Source File: ResultPane.java From marathonv5 with Apache License 2.0 | 6 votes |
private void setLabel() { String text; if (failuresList == null) { text = ""; } else if (failuresList.size() > 0) { String errorString = failuresList.size() == 1 ? " error" : " errors"; text = failuresList.size() + errorString; tableLabel.setTextFill(Color.RED); } else { text = "No Errors"; tableLabel.setTextFill(Color.GREEN); } tableLabel.setText(text); tableLabel.setFont(Font.font(tableLabel.getFont().toString(), FontWeight.BOLD, 12)); tableLabel.setLabelFor(resultTable); }
Example #17
Source File: ImagePanel.java From marathonv5 with Apache License 2.0 | 6 votes |
private void drawGraphics() { graphics.clearRect(0, 0, canvas.getWidth(), canvas.getHeight()); graphics.drawImage(image, 0, 0); if (annotations.size() > 0) { for (int i = 0; i < annotations.size(); i++) { Annotation annotationFX = annotations.get(i); double x = annotationFX.getX(); double y = annotationFX.getY(); graphics.setFill(ANNOTATION_COLOR); graphics.fillRect(x, y, annotationFX.getWidth(), annotationFX.getHeight()); graphics.setFill(Color.RED); graphics.fillArc(x - 25, y - 25, 50, 50, 270, 90, ArcType.ROUND); graphics.setFill(Color.WHITE); graphics.setFont(Font.font(null, FontWeight.EXTRA_BOLD, 14)); if (i > 8) { graphics.fillText(Integer.toString(i + 1), x + 5, y + 15); } else { graphics.fillText(Integer.toString(i + 1), x + 5, y + 15); } } } }
Example #18
Source File: StringBindingSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { Text text = new Text("abc"); text.setTextOrigin(VPos.TOP); text.setLayoutX(10); text.setLayoutY(11); text.setFill(Color.BLACK); text.setOpacity(0.5); text.setFont(Font.font(null, FontWeight.BOLD, 20)); text.setStyle("-fx-font-size: 20px;"); Text text2 = new Text("abc"); text2.setTextOrigin(VPos.TOP); text2.setLayoutX(28); text2.setLayoutY(51); text2.setFill(Color.BLACK); text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20)); text2.setStyle("-fx-font-size: 20px;"); Line line = new Line(30, 32, 45, 57); line.setStroke(Color.DARKMAGENTA); return new javafx.scene.Group(text, line, text2); }
Example #19
Source File: DropShadowSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public DropShadowSample() { Text sample = new Text(0,40,"DropShadow Effect"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,36)); final DropShadow dropShadow = new DropShadow(); sample.setEffect(dropShadow); getChildren().add(sample); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Radius", dropShadow.radiusProperty(), 0d, 20d), new SimplePropertySheet.PropDesc("Offset X", dropShadow.offsetXProperty(), -10d, 10d), new SimplePropertySheet.PropDesc("Offset Y", dropShadow.offsetYProperty(), -10d, 10d), new SimplePropertySheet.PropDesc("Spread", dropShadow.spreadProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Color", dropShadow.colorProperty()) ); // END REMOVE ME }
Example #20
Source File: AttributeCalculatorPane.java From constellation with Apache License 2.0 | 6 votes |
private void updateTemplateObjectHelp(final String itemName, final String itemDescription) { templateObjectHelp.getChildren().clear(); final Text objectNameText = new Text(itemName + ":\n"); objectNameText.setFont(Font.font(FONT_FAMILY, FontWeight.NORMAL, 16)); objectNameText.setFill(Color.web(TEXT_COLOR)); templateObjectHelp.getChildren().add(objectNameText); String objDescrip = " " + itemDescription + "\n"; final Text objectDescripText = new Text(objDescrip + "\n"); objectDescripText.setFont(Font.font(FONT_FAMILY, FontWeight.BOLD, 12)); objectDescripText.setFill(Color.WHITE); objectDescripText.setFontSmoothingType(FontSmoothingType.LCD); templateObjectHelp.getChildren().add(objectDescripText); }
Example #21
Source File: HTMLEditorSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { Text htmlStart = new Text("<html>"); Text htmlEnd = new Text("</html>"); htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20)); htmlStart.setStyle("-fx-font-size: 20px;"); htmlStart.setTextOrigin(VPos.TOP); htmlStart.setLayoutY(11); htmlStart.setLayoutX(20); htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20)); htmlEnd.setStyle("-fx-font-size: 20px;"); htmlEnd.setTextOrigin(VPos.TOP); htmlEnd.setLayoutY(31); htmlEnd.setLayoutX(20); return new Group(htmlStart, htmlEnd); }
Example #22
Source File: AutocompleteMenu.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** Create autocomplete menu */ public AutocompleteMenu(final ProposalService service) { this.proposal_service = service; final Font default_font = Font.getDefault(); header_font = Font.font(default_font.getFamily(), FontWeight.BOLD, default_font.getSize()); highlight_font = Font.font(default_font.getFamily(), FontWeight.BOLD, default_font.getSize()); }
Example #23
Source File: MainMenu.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public static StackPane getExitDialogPane(JFXButton b1, JFXButton b2, JFXButton b3) { Label l = new Label("Do you really want to exit ?");// mainScene.createBlendLabel(Msg.getString("MainScene.exit.header")); // l.setPadding(new Insets(10, 10, 10, 10)); l.setFont(Font.font(null, FontWeight.BOLD, 14)); l.setStyle("-fx-text-fill: white;"); b1.setStyle("-fx-background-color: grey;-fx-text-fill: white;"); b2.setStyle("-fx-background-color: grey;-fx-text-fill: white;"); if (b3 != null) b3.setStyle("-fx-background-color: grey;-fx-text-fill: white;"); HBox hb = new HBox(); hb.setAlignment(Pos.CENTER); if (b3 != null) hb.getChildren().addAll(b1, b2, b3); else hb.getChildren().addAll(b1, b2); HBox.setMargin(b1, new Insets(3, 3, 3, 3)); HBox.setMargin(b2, new Insets(3, 3, 3, 3)); if (b3 != null) HBox.setMargin(b3, new Insets(3, 3, 3, 3)); VBox vb = new VBox(); vb.setAlignment(Pos.CENTER); vb.setPadding(new Insets(5, 5, 5, 5)); vb.getChildren().addAll(l, hb); StackPane sp = new StackPane(vb); sp.setStyle("-fx-background-color: black;"); StackPane.setMargin(vb, new Insets(10, 10, 10, 10)); return sp; }
Example #24
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Text createTextHeader(String s) { Text t = new Text(); t.setCache(true); t.setX(10.0f); t.setY(270.0f); t.setFill(Color.WHITE);//.LIGHTBLUE);// .ORANGE);//.DARKSLATEGREY); t.setText(s); t.setFont(Font.font(null, FontWeight.BOLD, 14)); return t; }
Example #25
Source File: DropShadowSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { Text sample = new Text("FX"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80)); sample.setStyle("-fx-font-size: 80px;"); sample.setFill(Color.web("#333333")); final DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(4); dropShadow.setOffsetY(6); dropShadow.setColor(Color.rgb(0,0,0,0.7)); sample.setEffect(dropShadow); return sample; }
Example #26
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Text createBlackTextHeader(String s) { Text t = new Text(); t.setCache(true); t.setX(10.0f); t.setY(270.0f); t.setFill(Color.BLACK);//.LIGHTBLUE);// .ORANGE);//.DARKSLATEGREY); t.setText(s); t.setFont(Font.font(null, FontWeight.BOLD, 14)); return t; }
Example #27
Source File: FoxEatsDemoView.java From htm.java-examples with GNU Affero General Public License v3.0 | 5 votes |
public LabelledRadiusPane getDisplayPane() { LabelledRadiusPane left = new LabelledRadiusPane("Input Phrases"); lArea = new TextArea(); lArea.setWrapText(true); lArea.setFont(Font.font("Helvetica", FontWeight.MEDIUM, 16)); lArea.layoutYProperty().bind(left.labelHeightProperty().add(10)); left.layoutBoundsProperty().addListener((v, o, n) -> { lArea.setLayoutX(10); lArea.setPrefWidth(n.getWidth() - 20); lArea.setPrefHeight(n.getHeight() - left.labelHeightProperty().get() - 20); }); lArea.textProperty().addListener((v, o, n) -> { lArea.setScrollTop(Double.MAX_VALUE); lArea.setScrollLeft(Double.MAX_VALUE); }); left.getChildren().add(lArea); String smallTabs = "\t\t\t\t\t\t\t"; String bigTabs = "\t\t\t\t\t\t\t\t"; demo.getPhraseEntryProperty().addListener((v, o, n) -> { Platform.runLater(() -> { lArea.appendText("\n" + n[0] + (n[0].length() > 4 ? smallTabs : bigTabs) + n[1] + "\t\t\t\t\t\t\t\t" + n[2]); }); }); demo.getPhraseEndedProperty().addListener((v, o, n) -> { Platform.runLater(() -> { lArea.appendText("\n\nWhat does a fox eat?"); }); }); return left; }
Example #28
Source File: InnerShadowSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { Text sample = new Text("FX"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80)); sample.setStyle("-fx-font-size: 80px;"); sample.setFill(Color.web("#aaaaaa")); final InnerShadow innerShadow = new InnerShadow(); innerShadow.setRadius(4); innerShadow.setOffsetX(1); innerShadow.setOffsetY(1); innerShadow.setColor(Color.web("#333333")); sample.setEffect(innerShadow); return sample; }
Example #29
Source File: FxTextUtils.java From stagedisplayviewer with MIT License | 5 votes |
private double computeTextWidth(String text, double fontSize) { helperText.setText(text); helperText.setFont(Font.font(FONT_FAMILY.toString(), FontWeight.MEDIUM, fontSize)); helperText.setWrappingWidth(0.0D); double d = Math.min(helperText.prefWidth(-1.0D), 0.0D); helperText.setWrappingWidth((int) Math.ceil(d)); d = Math.ceil(helperText.getLayoutBounds().getWidth()); return d; }
Example #30
Source File: GaussianBlurSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { Text sample = new Text("FX"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80)); sample.setStyle("-fx-font-size: 80px;"); sample.setFill(Color.web("#333333")); final GaussianBlur GaussianBlur = new GaussianBlur(); GaussianBlur.setRadius(15); sample.setEffect(GaussianBlur); return sample; }