Java Code Examples for javafx.scene.text.FontWeight#NORMAL
The following examples show how to use
javafx.scene.text.FontWeight#NORMAL .
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: 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 2
Source File: GraphicsUtils.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Convert font * @param font AWT font * @return JFX font */ public static Font convert(final java.awt.Font font) { final FontWeight weight = font.isBold() ? FontWeight.BOLD : FontWeight.NORMAL; final FontPosture posture = font.isItalic() ? FontPosture.ITALIC : FontPosture.REGULAR; return Font.font(font.getFamily(), weight, posture, font.getSize()); }
Example 3
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 4
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 5
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 6
Source File: FXGraphics2D.java From ECG-Viewer with GNU General Public License v2.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 7
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 8
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 9
Source File: FontUtils.java From PDF4Teachers with Apache License 2.0 | 5 votes |
public static FontWeight getFontWeight(Font font) { String[] style = font.getStyle().split(" "); if(style.length >= 1){ if(style[0].equals("Bold")){ return FontWeight.BOLD; } } return FontWeight.NORMAL; }
Example 10
Source File: Exercise_16_14.java From Intro-to-Java-Programming with MIT License | 4 votes |
private FontWeight getWegiht() { return chkBold.isSelected() ? FontWeight.BOLD : FontWeight.NORMAL; }