Java Code Examples for java.awt.Font#getFontName()
The following examples show how to use
java.awt.Font#getFontName() .
These examples are extracted from open source projects.
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 Project: buffer_bci File: JThermometer.java License: GNU General Public License v3.0 | 5 votes |
/** * Sets the tick font style. * * @param style the style. */ public void setTickFontStyle(int style) { Font f = getTickLabelFont(); String fName = f.getFontName(); Font newFont = new Font(fName, style, f.getSize()); setTickLabelFont(newFont); }
Example 2
Source Project: buffer_bci File: JThermometer.java License: GNU General Public License v3.0 | 5 votes |
/** * Increases or decreases the tick font size. * * @param delta the change in size. */ public void changeTickFontSize(int delta) { Font f = getTickLabelFont(); String fName = f.getFontName(); Font newFont = new Font(fName, f.getStyle(), (f.getSize() + delta)); setTickLabelFont(newFont); }
Example 3
Source Project: ECG-Viewer File: JThermometer.java License: GNU General Public License v2.0 | 5 votes |
/** * Sets the tick font style. * * @param style the style. */ public void setTickFontStyle(int style) { Font f = getTickLabelFont(); String fName = f.getFontName(); Font newFont = new Font(fName, style, f.getSize()); setTickLabelFont(newFont); }
Example 4
Source Project: jdk8u60 File: DebugFonts.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) { System.setProperty("sun.java2d.debugfonts", "true"); Font font = new Font("dialog", Font.PLAIN, 14); System.out.println(font); String s1 = font.getFamily(); String s2 = font.getFontName(); }
Example 5
Source Project: openjdk-jdk8u File: DebugFonts.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) { System.setProperty("sun.java2d.debugfonts", "true"); Font font = new Font("dialog", Font.PLAIN, 14); System.out.println(font); String s1 = font.getFamily(); String s2 = font.getFontName(); }
Example 6
Source Project: raccoon4 File: TitleStrip.java License: Apache License 2.0 | 5 votes |
public TitleStrip(String title, String subTitle, Icon icon) { this.title = new JLabel(title); this.subTitle = new JLabel(subTitle); this.icon = new JLabel(icon); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); Font font = this.title.getFont(); Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize() + 4); this.title.setFont(boldFont); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 1; gbc.insets.top = 5; gbc.insets.left = 5; gbc.insets.right = 5; gbc.insets.bottom = 5; add(this.title, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0; gbc.insets.left = 15; add(this.subTitle, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.gridheight = 2; gbc.anchor = GridBagConstraints.CENTER; add(this.icon, gbc); }
Example 7
Source Project: osrsclient File: NotesPanel.java License: GNU General Public License v2.0 | 5 votes |
public void actionPerformed(ActionEvent e){ Font f = notewindow.getFont(); if(f.getSize() > 12){ Font f2 = new Font(f.getFontName(), f.getStyle(), f.getSize() - 2); notewindow.setFont(f2); } }
Example 8
Source Project: CSSBox File: GraphicsVisualContext.java License: GNU Lesser General Public License v3.0 | 5 votes |
@Override protected String registerExternalFont(TermURI urlstring, String format) throws MalformedURLException, IOException { String nameFound = null; if (format == null || FontDecoder.supportedFormats.contains(format)) { URL url = DataURLHandler.createURL(urlstring.getBase(), urlstring.getValue()); String regName = FontDecoder.findRegisteredFont(url); if (regName == null) { DocumentSource imgsrc = getViewport().getConfig().createDocumentSource(url); Font newFont; try { newFont = FontDecoder.decodeFont(imgsrc, format); } catch (FontFormatException e) { throw new IOException(e); } if (GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(newFont)) log.debug("Registered font: {}", newFont.getFontName()); else log.debug("Failed to register font: {} (not fatal, probably already existing)", newFont.getFontName()); regName = newFont.getFontName(); FontDecoder.registerFont(url, regName); } nameFound = regName; } return nameFound; }
Example 9
Source Project: jdk8u-jdk File: DebugFonts.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) { System.setProperty("sun.java2d.debugfonts", "true"); Font font = new Font("dialog", Font.PLAIN, 14); System.out.println(font); String s1 = font.getFamily(); String s2 = font.getFontName(); }
Example 10
Source Project: astor File: FontDisplayField.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a string representation of the specified font. * * @param font the font. * * @return a string describing the font. */ private String fontToString(Font font) { if (font != null) { return font.getFontName() + ", " + font.getSize(); } else { return localizationResources.getString("No_Font_Selected"); } }
Example 11
Source Project: ccu-historian File: JThermometer.java License: GNU General Public License v3.0 | 5 votes |
/** * Sets the tick font style. * * @param style the style. */ public void setTickFontStyle(int style) { Font f = getTickLabelFont(); String fName = f.getFontName(); Font newFont = new Font(fName, style, f.getSize()); setTickLabelFont(newFont); }
Example 12
Source Project: astor File: JThermometer.java License: GNU General Public License v2.0 | 5 votes |
/** * Increases or decreases the tick font size. * * @param delta the change in size. */ public void changeTickFontSize(int delta) { Font f = getTickLabelFont(); String fName = f.getFontName(); Font newFont = new Font(fName, f.getStyle(), (f.getSize() + delta)); setTickLabelFont(newFont); }
Example 13
Source Project: hottub File: DebugFonts.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) { System.setProperty("sun.java2d.debugfonts", "true"); Font font = new Font("dialog", Font.PLAIN, 14); System.out.println(font); String s1 = font.getFamily(); String s2 = font.getFontName(); }
Example 14
Source Project: jdk8u_jdk File: DebugFonts.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) { System.setProperty("sun.java2d.debugfonts", "true"); Font font = new Font("dialog", Font.PLAIN, 14); System.out.println(font); String s1 = font.getFamily(); String s2 = font.getFontName(); }
Example 15
Source Project: sldeditor File: CharMap4Grid.java License: GNU General Public License v3.0 | 5 votes |
/** * Mouse replace text. * * <p>After a mouse click, or the pop-up menu simulating a mouse click, call this method with a * string to be added to the sample text. * * @param text the text */ private void mouseReplaceText(String text, int index) { Font font = charMap4.getDisplayFont(); if (font != null) { selectedFont = font.getFontName(); selectedChar = index; String displayText = String.format("ttf://%s#%s", font.getFontName(), text); charMap4.setSelectedCharacter(displayText); } }
Example 16
Source Project: raccoon4 File: BriefAppDescriptionBuilder.java License: Apache License 2.0 | 4 votes |
@Override protected JPanel assemble() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); JLabel appNameLabel = new JLabel(doc.getTitle(), SwingConstants.CENTER); Font font = appNameLabel.getFont(); Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize() + 2); appNameLabel.setFont(boldFont); appNameLabel.setToolTipText(doc.getTitle()); Dimension tmp = appNameLabel.getPreferredSize(); tmp.width = 150; appNameLabel.setPreferredSize(tmp); JLabel vendorNameLabel = new JLabel(doc.getCreator(), SwingConstants.CENTER); tmp = vendorNameLabel.getPreferredSize(); tmp.width = 150; vendorNameLabel.setPreferredSize(tmp); vendorNameLabel.setToolTipText(doc.getCreator()); button = new JButton(); button.addActionListener(this); button.setIcon(SPINNER); globals.get(ImageLoaderService.class).request(this, DocUtil.getAppIconUrl(doc)); JPanel stars = new StarPanel(5, doc.getAggregateRating().getStarRating() / 5); DecimalFormat df = new DecimalFormat("#.## \u2605"); stars.setToolTipText(df.format(doc.getAggregateRating().getStarRating())); gbc.gridx = 0; gbc.gridy = 0; gbc.insets.bottom = 10; panel.add(button, gbc); gbc.insets.bottom = 0; gbc.gridy++; panel.add(appNameLabel, gbc); gbc.gridy++; panel.add(vendorNameLabel, gbc); gbc.gridy++; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets.top = 10; gbc.insets.left = 15; gbc.insets.right = 15; gbc.insets.bottom = 15; panel.add(stars, gbc); return panel; }
Example 17
Source Project: Hyperium File: HyperiumFontRenderer.java License: GNU Lesser General Public License v3.0 | 4 votes |
public HyperiumFontRenderer(Font font) { this(font.getFontName(), font.getSize()); }
Example 18
Source Project: raccoon4 File: ListItemBuilder.java License: Apache License 2.0 | 4 votes |
@Override protected JPanel assemble() { icon = new JButton(new ImageIcon(image.getScaledInstance(48, 48, Image.SCALE_SMOOTH))); icon.addActionListener(this); checked = new JCheckBox(); JLabel name = new JLabel(androidApp.getName()); Font font = name.getFont(); Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize() + 2); name.setFont(boldFont); JLabel version = new JLabel(androidApp.getVersion()); Font italic = new Font(font.getFontName(), Font.ITALIC, font.getSize()); version.setFont(italic); panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 5; gbc.insets.left = 5; gbc.insets.bottom = 5; gbc.insets.right = 5; gbc.weightx = 0; gbc.weighty = 0; gbc.gridheight = 3; panel.add(icon, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets.top = 10; gbc.insets.left = 0; gbc.insets.bottom = 0; gbc.insets.right = 0; gbc.weightx = 1; gbc.weighty = 0; gbc.gridheight = 1; panel.add(name, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets.top = 3; gbc.insets.left = 0; gbc.insets.bottom = 0; gbc.insets.right = 0; gbc.weightx = 0; gbc.weighty = 0; gbc.gridheight = 1; panel.add(version, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.NORTHEAST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets.top = 3; gbc.insets.left = 0; gbc.insets.bottom = 0; gbc.insets.right = 0; gbc.weightx = 0; gbc.weighty = 0; gbc.gridheight = 1; panel.add(checked, gbc); return panel; }
Example 19
Source Project: lams File: FontMetricsDumper.java License: GNU General Public License v2.0 | 4 votes |
@SuppressForbidden("command line tool") public static void main(String[] args) throws IOException { Properties props = new Properties(); Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); for (Font allFont : allFonts) { String fontName = allFont.getFontName(); Font font = new Font(fontName, Font.BOLD, 10); FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font); int fontHeight = fontMetrics.getHeight(); props.setProperty("font." + fontName + ".height", fontHeight + ""); StringBuilder characters = new StringBuilder(); for (char c = 'a'; c <= 'z'; c++) { characters.append(c).append(", "); } for (char c = 'A'; c <= 'Z'; c++) { characters.append(c).append(", "); } for (char c = '0'; c <= '9'; c++) { characters.append(c).append(", "); } StringBuilder widths = new StringBuilder(); for (char c = 'a'; c <= 'z'; c++) { widths.append(fontMetrics.getWidths()[c]).append(", "); } for (char c = 'A'; c <= 'Z'; c++) { widths.append(fontMetrics.getWidths()[c]).append(", "); } for (char c = '0'; c <= '9'; c++) { widths.append(fontMetrics.getWidths()[c]).append(", "); } props.setProperty("font." + fontName + ".characters", characters.toString()); props.setProperty("font." + fontName + ".widths", widths.toString()); } OutputStream fileOut = new FileOutputStream("font_metrics.properties"); try { props.store(fileOut, "Font Metrics"); } finally { fileOut.close(); } }
Example 20
Source Project: gama File: FontCache.java License: GNU General Public License v3.0 | 4 votes |
public void process(final Font font, final float withSize) { final Font f = new Font(font.getFontName(), font.getStyle(), (int) withSize); fontsToProcess.add(f); }