java.awt.Font#getFontName ( )源码实例Demo

下面列出了java.awt.Font#getFontName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: buffer_bci   文件: JThermometer.java
/**
 * 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);
}
 
源代码2 项目: buffer_bci   文件: JThermometer.java
/**
 * 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);
}
 
源代码3 项目: ECG-Viewer   文件: JThermometer.java
/**
 * 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);
}
 
源代码4 项目: jdk8u60   文件: DebugFonts.java
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();
}
 
源代码5 项目: openjdk-jdk8u   文件: DebugFonts.java
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();
}
 
源代码6 项目: raccoon4   文件: TitleStrip.java
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);
}
 
源代码7 项目: osrsclient   文件: NotesPanel.java
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);
    }
}
 
源代码8 项目: CSSBox   文件: GraphicsVisualContext.java
@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;
}
 
源代码9 项目: jdk8u-jdk   文件: DebugFonts.java
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();
}
 
源代码10 项目: astor   文件: FontDisplayField.java
/**
 * 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");
    }
}
 
源代码11 项目: ccu-historian   文件: JThermometer.java
/**
 * 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);
}
 
源代码12 项目: astor   文件: JThermometer.java
/**
 * 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);
}
 
源代码13 项目: hottub   文件: DebugFonts.java
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();
}
 
源代码14 项目: jdk8u_jdk   文件: DebugFonts.java
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();
}
 
源代码15 项目: sldeditor   文件: CharMap4Grid.java
/**
 * 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);
    }
}
 
源代码16 项目: raccoon4   文件: BriefAppDescriptionBuilder.java
@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;
}
 
源代码17 项目: Hyperium   文件: HyperiumFontRenderer.java
public HyperiumFontRenderer(Font font) {
    this(font.getFontName(), font.getSize());
}
 
源代码18 项目: raccoon4   文件: ListItemBuilder.java
@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;
}
 
源代码19 项目: lams   文件: FontMetricsDumper.java
@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();
    }
}
 
源代码20 项目: gama   文件: FontCache.java
public void process(final Font font, final float withSize) {
	final Font f = new Font(font.getFontName(), font.getStyle(), (int) withSize);
	fontsToProcess.add(f);
}