Java Code Examples for javax.swing.plaf.FontUIResource#getStyle()

The following examples show how to use javax.swing.plaf.FontUIResource#getStyle() . 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: NeonFontSet.java    From radiance with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Returns Neon-specific font resource.
 *
 * @param systemFont    The default system font.
 * @param toBoldify     If <code>true</code>, the original font (the first parameter) is
 *                      boldified.
 * @param extraFontSize Extra font size in pixels.
 * @return Neon-specific font resource.
 */
private FontUIResource getNeonFont(FontUIResource systemFont, boolean toBoldify,
        int extraFontSize) {
    boolean isOrigItalic = systemFont.isItalic();
    int newStyle = systemFont.getStyle();
    if (toBoldify) {
        if (isOrigItalic) {
            newStyle = Font.ITALIC + Font.BOLD;
        } else {
            newStyle = Font.BOLD;
        }
    }
    Font derived = systemFont.deriveFont((float) (systemFont.getSize() + extraFontSize))
            .deriveFont(newStyle);
    if (derived instanceof FontUIResource) {
        return (FontUIResource) derived;
    }
    return new FontUIResource(derived);
}
 
Example 2
Source File: MyLocaleChangeListener.java    From radiance with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns the wrapped font.
 * 
 * @param systemFont
 *            Original font.
 * @return Wrapped font.
 */
private FontUIResource getWrappedFont(FontUIResource systemFont) {
    return new FontUIResource("Dialog", systemFont.getStyle(), systemFont.getSize());
}
 
Example 3
Source File: GetFontPolicy.java    From radiance with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns the wrapped font.
 *
 * @param systemFont Original font.
 * @return Wrapped font.
 */
private FontUIResource getWrappedFont(FontUIResource systemFont) {
    return new FontUIResource(systemFont.getFontName(), systemFont.getStyle(),
            systemFont.getSize() + this.extra);
}
 
Example 4
Source File: SetFontPolicy.java    From radiance with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns the wrapped font.
 *
 * @param systemFont Original font.
 * @return Wrapped font.
 */
private FontUIResource getWrappedFont(FontUIResource systemFont) {
    return new FontUIResource(systemFont.getFontName(), systemFont.getStyle(),
            systemFont.getSize() + this.extra);
}
 
Example 5
Source File: ScaledFontSet.java    From radiance with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns the wrapped font.
 * 
 * @param systemFont
 *            Original font.
 * @return Wrapped font.
 */
private FontUIResource getWrappedFont(FontUIResource systemFont) {
	return new FontUIResource(systemFont.getFontName(), systemFont
			.getStyle(), (int) (systemFont.getSize() * this.scaleFactor));
}