Java 类javax.swing.plaf.FontUIResource 实例源码

项目:OpenJSharp    文件:X11FontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
项目:featurea    文件:FSTable.java   
private void setupKeyColumnWidth() {
    FontUIResource font = (FontUIResource) UIManager.get("Table.font");
    for (int j = 0; j < getColumnModel().getColumnCount(); j++) {
        TableColumn column = getColumnModel().getColumn(j);
        Integer columnWidth = columnWidthMap.get(j);
        if (columnWidth != null) {
            int fixedSize = columnWidth;
            if (fixedSize == -1) {
                double max = 0;
                int rowCount = getModel().getRowCount();
                for (int i = 0; i < rowCount; i++) {
                    String text = getValueAt(i, 0).toString();
                    int width = SwingUtils.getWidth(font, text);
                    max = Math.max(max, width);
                }
                fixedSize = (int) (max + 16 * 2);
            }
            column.setMinWidth(fixedSize);
            column.setMaxWidth(fixedSize);
        }
    }
}
项目:jdk8u-jdk    文件:X11FontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
项目:openjdk-jdk10    文件:X11FontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
项目:WePush    文件:Init.java   
/**
 * 设置全局字体
 */
public static void initGlobalFont() {

    String lowDpiKey = "lowDpiInit";
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //得到屏幕的尺寸
    if (screenSize.width <= 1366 && StringUtils.isEmpty(configer.getProps(lowDpiKey))) {
        configer.setFontSize(15);
        configer.setProps(lowDpiKey, "true");
        configer.save();
    }

    Font fnt = new Font(configer.getFont(), Font.PLAIN, configer.getFontSize());
    FontUIResource fontRes = new FontUIResource(fnt);
    for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements(); ) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource)
            UIManager.put(key, fontRes);
    }
}
项目:openjdk9    文件:X11FontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
项目:intellij-ce-playground    文件:LafManagerImpl.java   
@SuppressWarnings({"HardCodedStringLiteral"})
static void initFontDefaults(UIDefaults defaults, String fontFace, int fontSize) {
  defaults.put("Tree.ancestorInputMap", null);
  FontUIResource uiFont = new FontUIResource(fontFace, Font.PLAIN, fontSize);
  FontUIResource textFont = new FontUIResource("Serif", Font.PLAIN, fontSize);
  FontUIResource monoFont = new FontUIResource("Monospaced", Font.PLAIN, fontSize);

  for (String fontResource : ourPatchableFontResources) {
    defaults.put(fontResource, uiFont);
  }

  defaults.put("PasswordField.font", monoFont);
  defaults.put("TextArea.font", monoFont);
  defaults.put("TextPane.font", textFont);
  defaults.put("EditorPane.font", textFont);
}
项目:orbit-image-analysis    文件:AWTConverters.java   
public void register(ConverterRegistry registry) {
  registry.addConverter(Dimension.class, String.class, this);
  registry.addConverter(String.class, Dimension.class, this);
  registry.addConverter(DimensionUIResource.class, String.class, this);

  registry.addConverter(Insets.class, String.class, this);
  registry.addConverter(String.class, Insets.class, this);
  registry.addConverter(InsetsUIResource.class, String.class, this);

  registry.addConverter(Point.class, String.class, this);
  registry.addConverter(String.class, Point.class, this);

  registry.addConverter(Rectangle.class, String.class, this);
  registry.addConverter(String.class, Rectangle.class, this);

  registry.addConverter(Font.class, String.class, this);
  registry.addConverter(FontUIResource.class, String.class, this);
}
项目:PhET    文件:NaturalSelectionApplication.java   
public static void setAccessibilityFontScale( final float scale ) {
    SwingUtilities.invokeLater( new Runnable() {
        public void run() {
            UIDefaults defaults = UIManager.getDefaults();
            Enumeration keys = defaults.keys();
            while ( keys.hasMoreElements() ) {
                Object key = keys.nextElement();
                Object value = defaults.get( key );
                if ( value != null && value instanceof Font ) {
                    UIManager.put( key, null );
                    Font font = UIManager.getFont( key );
                    if ( font != null ) {
                        float size = font.getSize2D();
                        UIManager.put( key, new FontUIResource( font.deriveFont( size * scale ) ) );
                    }
                }
            }
        }
    } );

}
项目:jdk8u_jdk    文件:X11FontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
项目:Prism-gsoc16    文件:GUIPrism.java   
/**
 *  Adjust the main font for the GUI (+1 = one size up, -1 = one size down)
 */
public void adjustFont(int adjust)
{
    Object[] objs = UIManager.getLookAndFeel().getDefaults().keySet().toArray();
    for (int i = 0; i < objs.length; i++) {
        if (objs[i].toString().toUpperCase().indexOf(".FONT") != -1) {
            Font font = UIManager.getFont(objs[i]);
            font = font.deriveFont((float) (font.getSize() + adjust));
            UIManager.put(objs[i], new FontUIResource(font));
        }
    }
    SwingUtilities.updateComponentTreeUI(this);
    SwingUtilities.updateComponentTreeUI(choose);
    SwingUtilities.updateComponentTreeUI(options);
    repaint();
}
项目:lookaside_java-1.8.0-openjdk    文件:X11FontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
项目:iSeleda    文件:CategoryAddon.java   
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addBasicDefaults(addon, defaults);

    Font font = UIManagerExt.getSafeFont("Label.font", new Font("Dialog", Font.PLAIN, 12));
    font = font.deriveFont(Font.BOLD, 13f);

    defaults.add(JXCategory.uiClassID, BasicCategoryUI.class.getName());
    defaults.add("Category.font", UIManagerExt.getSafeFont("TextPane.font",
              new FontUIResource("Serif", Font.PLAIN, 12)));
    defaults.add("Category.tipFont", new FontUIResource(font));
    defaults.add("Category.background", new ColorUIResource(Color.WHITE));
    defaults.add("Category.icon",
            LookAndFeel.makeIcon(BasicCategoryUI.class, "resources/dictionary_categories.png"));
    defaults.add("Category.border", new BorderUIResource(
            BorderFactory.createLineBorder(new Color(117, 117, 117))));

  UIManagerExt.addResourceBundle(
          "org.jdesktop.swingx.plaf.basic.resources.Category");
}
项目:iSeleda    文件:CategoryAddon.java   
/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);

  Font font = UIManagerExt.getSafeFont("Label.font",
          new Font("Dialog", Font.PLAIN, 12));
  font = font.deriveFont(13f);

  defaults.add(JXCategory.uiClassID, WindowsTipOfTheDayUI.class.getName());
  defaults.add("Category.background", new ColorUIResource(Color.GRAY));
  defaults.add("Category.font", new FontUIResource(font));
  defaults.add("Category.icon",
          LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class, "resources/tipoftheday.png"));
  defaults.add("Category.border" ,new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));

  UIManagerExt.addResourceBundle(
      "org.jdesktop.swingx.plaf.windows.resources.TipOfTheDay");
}
项目:iSeleda    文件:TipOfTheDayAddon.java   
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addBasicDefaults(addon, defaults);

    Font font = UIManagerExt.getSafeFont("Label.font", new Font("Dialog", Font.PLAIN, 12));
    font = font.deriveFont(Font.BOLD, 13f);

    defaults.add(JXTipOfTheDay.uiClassID, BasicTipOfTheDayUI.class.getName());
    defaults.add("TipOfTheDay.font", UIManagerExt.getSafeFont("TextPane.font",
              new FontUIResource("Serif", Font.PLAIN, 12)));
    defaults.add("TipOfTheDay.tipFont", new FontUIResource(font));
    defaults.add("TipOfTheDay.background", new ColorUIResource(Color.WHITE));
    defaults.add("TipOfTheDay.icon",
            LookAndFeel.makeIcon(BasicTipOfTheDayUI.class, "resources/TipOfTheDay24.gif"));
    defaults.add("TipOfTheDay.border", new BorderUIResource(
            BorderFactory.createLineBorder(new Color(117, 117, 117))));

  UIManagerExt.addResourceBundle(
          "org.jdesktop.swingx.plaf.basic.resources.TipOfTheDay");
}
项目:iSeleda    文件:TipOfTheDayAddon.java   
/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);

  Font font = UIManagerExt.getSafeFont("Label.font",
          new Font("Dialog", Font.PLAIN, 12));
  font = font.deriveFont(13f);

  defaults.add(JXTipOfTheDay.uiClassID, WindowsTipOfTheDayUI.class.getName());
  defaults.add("TipOfTheDay.background", new ColorUIResource(Color.GRAY));
  defaults.add("TipOfTheDay.font", new FontUIResource(font));
  defaults.add("TipOfTheDay.icon",
          LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class, "resources/tipoftheday.png"));
  defaults.add("TipOfTheDay.border" ,new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));

  UIManagerExt.addResourceBundle(
      "org.jdesktop.swingx.plaf.windows.resources.TipOfTheDay");
}
项目:LS-jsampler    文件:ViewConfig.java   
/**
 * Sets the default font to be used in the GUI.
 * @param fontName The name of the font to be used as default.
 */
public void
setUIDefaultFont(String fontName) {
    if(fontName == null) return;

    java.util.Enumeration keys = UIManager.getDefaults().keys();
    while(keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if(value instanceof FontUIResource) {
            Font f = (FontUIResource)value;
            FontUIResource fr =
                new FontUIResource(fontName, f.getStyle(), f.getSize());
            UIManager.put(key, fr);
        }
    }
}
项目:javify    文件:DefaultMetalTheme.java   
/**
 * Returns the appropriate font. The font type to return is identified
 * by the specified id.
 *
 * @param id the font type to return
 *
 * @return the correct font
 */
private FontUIResource getFont(int id)
{
  FontUIResource font = null;
  switch (id)
    {
    case CONTROL_TEXT_FONT:
      if (isBoldMetal())
        font = BOLD_CONTROL_TEXT_FONT;
      else
        font = PLAIN_CONTROL_TEXT_FONT;
      break;
    case MENU_TEXT_FONT:
      if (isBoldMetal())
        font = BOLD_MENU_TEXT_FONT;
      else
        font = PLAIN_MENU_TEXT_FONT;
    break;
    // TODO: Add other font types and their mapping here.
    }
  return font;
}
项目:intellij-ce-playground    文件:IntelliJLaf.java   
private static void installMacOSXFonts(UIDefaults defaults) {
  String face = "HelveticaNeue-Regular";
  LafManagerImpl.initFontDefaults(defaults, face, 13);
  for (Object key : new HashSet<Object>(defaults.keySet())) {
    Object value = defaults.get(key);
    if (value instanceof FontUIResource) {
      FontUIResource font = (FontUIResource)value;
      if (font.getFamily().equals("Lucida Grande") || font.getFamily().equals("Serif")) {
        if (!key.toString().contains("Menu")) {
          defaults.put(key, new FontUIResource(face, font.getStyle(), font.getSize()));
        }
      }
    }
  }
  FontUIResource uiFont11 = new FontUIResource("HelveticaNeue-Medium", Font.PLAIN, 11);
  defaults.put("TableHeader.font", uiFont11);

  FontUIResource buttonFont = new FontUIResource("HelveticaNeue-Medium", Font.PLAIN, 13);
  defaults.put("Button.font", buttonFont);
  Font menuFont = new FontUIResource("Lucida Grande", Font.PLAIN, 14);
  defaults.put("Menu.font", menuFont);
  defaults.put("MenuItem.font", menuFont);
  defaults.put("MenuItem.acceleratorFont", menuFont);
  defaults.put("PasswordField.font", defaults.getFont("TextField.font"));
}
项目:incubator-netbeans    文件:EnhancedTreeCellRenderer.java   
/**
 * Subclassed to map <code>FontUIResource</code>s to null. If
 * <code>font</code> is null, or a <code>FontUIResource</code>, this
 * has the effect of letting the font of the JTree show
 * through. On the other hand, if <code>font</code> is non-null, and not
 * a <code>FontUIResource</code>, the font becomes <code>font</code>.
 */
public void setFont(Font font) {
    if (font instanceof FontUIResource) {
        font = null;
    }

    super.setFont(font);
}
项目:VASSAL-src    文件:ProgressDialogTest.java   
@Override
public UIDefaults getDefaults() {
  final float scale = 3f;

  final UIDefaults defaults = super.getDefaults();

  final Map<Object,Object> changes = new HashMap<Object,Object>();

  for (Map.Entry<Object,Object> e : defaults.entrySet()) {
    final Object key = e.getKey();
    final Object val = e.getValue();

    if (val instanceof FontUIResource) {
      final FontUIResource ores = (FontUIResource) val;
      final FontUIResource nres =
        new FontUIResource(ores.deriveFont(ores.getSize2D()*scale));
      changes.put(key, nres);
      System.out.println(key + " = " + nres);
    }
    else if (val instanceof Font) {
      final Font ofont = (Font) val;
      final Font nfont = ofont.deriveFont(ofont.getSize2D()*scale);
      changes.put(key, nfont);
      System.out.println(key + " = " + nfont);
    }
  }

  defaults.putAll(changes);

  return defaults;
}
项目:OpenJSharp    文件:DefaultTreeCellEditor.java   
public Font getFont() {
    Font     font = super.getFont();

    // Prefer the parent containers font if our font is a
    // FontUIResource
    if(font instanceof FontUIResource) {
        Container     parent = getParent();

        if(parent != null && parent.getFont() != null)
            font = parent.getFont();
    }
    return font;
}
项目:OpenJSharp    文件:DefaultSynthStyleFactory.java   
/**
 * Returns the style to use if there are no matching styles.
 */
private SynthStyle getDefaultStyle() {
    if (_defaultStyle == null) {
        _defaultStyle = new DefaultSynthStyle();
        ((DefaultSynthStyle)_defaultStyle).setFont(
            new FontUIResource(Font.DIALOG, Font.PLAIN,12));
    }
    return _defaultStyle;
}
项目:OpenJSharp    文件:CFontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(
        String family, int style, int size)
{
    String mappedName = FontUtilities.mapFcName(family);
    if (mappedName == null) {
        mappedName = "sansserif";
    }
    return new FontUIResource(mappedName, style, size);
}
项目:jdk8u-jdk    文件:DefaultTreeCellEditor.java   
public Font getFont() {
    Font     font = super.getFont();

    // Prefer the parent containers font if our font is a
    // FontUIResource
    if(font instanceof FontUIResource) {
        Container     parent = getParent();

        if(parent != null && parent.getFont() != null)
            font = parent.getFont();
    }
    return font;
}
项目:jdk8u-jdk    文件:DefaultSynthStyleFactory.java   
/**
 * Returns the style to use if there are no matching styles.
 */
private SynthStyle getDefaultStyle() {
    if (_defaultStyle == null) {
        _defaultStyle = new DefaultSynthStyle();
        ((DefaultSynthStyle)_defaultStyle).setFont(
            new FontUIResource(Font.DIALOG, Font.PLAIN,12));
    }
    return _defaultStyle;
}
项目:jdk8u-jdk    文件:CFontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(
        String family, int style, int size)
{
    String mappedName = FontUtilities.mapFcName(family);
    if (mappedName == null) {
        mappedName = "sansserif";
    }
    return new FontUIResource(mappedName, style, size);
}
项目:jdk8u-jdk    文件:javax_swing_plaf_FontUIResource.java   
protected FontUIResource getObject() {
    return new FontUIResource(
            new Font(
                    Collections.singletonMap(
                            TextAttribute.STRIKETHROUGH,
                            TextAttribute.STRIKETHROUGH_ON)));
}
项目:openjdk-jdk10    文件:FontUtilities.java   
public static FontUIResource getCompositeFontUIResource(Font font) {

        FontUIResource fuir = new FontUIResource(font);
        Font2D font2D = FontUtilities.getFont2D(font);

        if (!(font2D instanceof PhysicalFont)) {
            /* Swing should only be calling this when a font is obtained
             * from desktop properties, so should generally be a physical font,
             * an exception might be for names like "MS Serif" which are
             * automatically mapped to "Serif", so there's no need to do
             * anything special in that case. But note that suggested usage
             * is first to call fontSupportsDefaultEncoding(Font) and this
             * method should not be called if that were to return true.
             */
             return fuir;
        }

        FontManager fm = FontManagerFactory.getInstance();
        Font2D dialog = fm.findFont2D("dialog", font.getStyle(), FontManager.NO_FALLBACK);
        // Should never be null, but MACOSX fonts are not CompositeFonts
        if (dialog == null || !(dialog instanceof CompositeFont)) {
            return fuir;
        }
        CompositeFont dialog2D = (CompositeFont)dialog;
        PhysicalFont physicalFont = (PhysicalFont)font2D;
        ConcurrentHashMap<PhysicalFont, CompositeFont> compMap = compMapRef.get();
        if (compMap == null) { // Its been collected.
            compMap = new ConcurrentHashMap<PhysicalFont, CompositeFont>();
            compMapRef = new SoftReference<>(compMap);
        }
        CompositeFont compFont = compMap.get(physicalFont);
        if (compFont == null) {
            compFont = new CompositeFont(physicalFont, dialog2D);
            compMap.put(physicalFont, compFont);
        }
        FontAccess.getFontAccess().setFont2D(fuir, compFont.handle);
        /* marking this as a created font is needed as only created fonts
         * copy their creator's handles.
         */
        FontAccess.getFontAccess().setCreatedFont(fuir);
        return fuir;
    }
项目:openjdk-jdk10    文件:DefaultTreeCellEditor.java   
public Font getFont() {
    Font     font = super.getFont();

    // Prefer the parent containers font if our font is a
    // FontUIResource
    if(font instanceof FontUIResource) {
        Container     parent = getParent();

        if(parent != null && parent.getFont() != null)
            font = parent.getFont();
    }
    return font;
}
项目:openjdk-jdk10    文件:DefaultSynthStyleFactory.java   
/**
 * Returns the style to use if there are no matching styles.
 */
private SynthStyle getDefaultStyle() {
    if (_defaultStyle == null) {
        _defaultStyle = new DefaultSynthStyle();
        ((DefaultSynthStyle)_defaultStyle).setFont(
            new FontUIResource(Font.DIALOG, Font.PLAIN,12));
    }
    return _defaultStyle;
}
项目:openjdk-jdk10    文件:CFontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(
        String family, int style, int size)
{
    String mappedName = FontUtilities.mapFcName(family);
    if (mappedName == null) {
        mappedName = "sansserif";
    }
    return new FontUIResource(mappedName, style, size);
}
项目:openjdk-jdk10    文件:javax_swing_plaf_FontUIResource.java   
protected FontUIResource getObject() {
    return new FontUIResource(
            new Font(
                    Collections.singletonMap(
                            TextAttribute.STRIKETHROUGH,
                            TextAttribute.STRIKETHROUGH_ON)));
}
项目:openjdk9    文件:DefaultTreeCellEditor.java   
public Font getFont() {
    Font     font = super.getFont();

    // Prefer the parent containers font if our font is a
    // FontUIResource
    if(font instanceof FontUIResource) {
        Container     parent = getParent();

        if(parent != null && parent.getFont() != null)
            font = parent.getFont();
    }
    return font;
}
项目:openjdk9    文件:DefaultSynthStyleFactory.java   
/**
 * Returns the style to use if there are no matching styles.
 */
private SynthStyle getDefaultStyle() {
    if (_defaultStyle == null) {
        _defaultStyle = new DefaultSynthStyle();
        ((DefaultSynthStyle)_defaultStyle).setFont(
            new FontUIResource(Font.DIALOG, Font.PLAIN,12));
    }
    return _defaultStyle;
}
项目:openjdk9    文件:CFontManager.java   
@Override
protected FontUIResource getFontConfigFUIR(
        String family, int style, int size)
{
    String mappedName = FontUtilities.mapFcName(family);
    if (mappedName == null) {
        mappedName = "sansserif";
    }
    return new FontUIResource(mappedName, style, size);
}
项目:openjdk9    文件:javax_swing_plaf_FontUIResource.java   
protected FontUIResource getObject() {
    return new FontUIResource(
            new Font(
                    Collections.singletonMap(
                            TextAttribute.STRIKETHROUGH,
                            TextAttribute.STRIKETHROUGH_ON)));
}
项目:Java8CN    文件:DefaultTreeCellEditor.java   
public Font getFont() {
    Font     font = super.getFont();

    // Prefer the parent containers font if our font is a
    // FontUIResource
    if(font instanceof FontUIResource) {
        Container     parent = getParent();

        if(parent != null && parent.getFont() != null)
            font = parent.getFont();
    }
    return font;
}
项目:ALLIN    文件:MazeGUI.java   
private static void InitGlobalFont(Font font) {
    FontUIResource fontRes = new FontUIResource(font);
    for (Enumeration<Object> keys = UIManager.getDefaults().keys();
         keys.hasMoreElements(); ) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource) {
            UIManager.put(key, fontRes);
        }
    }
}
项目:orbit-image-analysis    文件:JTaskPaneGroupAddon.java   
protected void addBasicDefaults(LookAndFeelAddons addon, List defaults) {
  Color menuBackground = new ColorUIResource(SystemColor.menu);
  defaults.addAll(Arrays.asList(new Object[]{
    JTaskPaneGroup.UI_CLASS_ID,
    "com.l2fprod.common.swing.plaf.basic.BasicTaskPaneGroupUI",
    "TaskPaneGroup.font",
    new FontUIResource(
      UIManager.getFont("Label.font").deriveFont(Font.BOLD)),        
    "TaskPaneGroup.background",
    UIManager.getColor("List.background"),
    "TaskPaneGroup.specialTitleBackground",
    new ColorUIResource(menuBackground.darker()),
    "TaskPaneGroup.titleBackgroundGradientStart",
    menuBackground,
    "TaskPaneGroup.titleBackgroundGradientEnd",
    menuBackground,
    "TaskPaneGroup.titleForeground",
    new ColorUIResource(SystemColor.menuText),
    "TaskPaneGroup.specialTitleForeground",
    new ColorUIResource(SystemColor.menuText).brighter(),
    "TaskPaneGroup.animate",
    Boolean.TRUE,
    "TaskPaneGroup.focusInputMap",
    new UIDefaults.LazyInputMap(
      new Object[] {
        "ENTER",
        "toggleExpanded",
        "SPACE",
        "toggleExpanded" }),
  }));
}