当前位置: 首页>>代码示例>>Java>>正文


Java ComponentPeer.setFont方法代码示例

本文整理汇总了Java中java.awt.peer.ComponentPeer.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentPeer.setFont方法的具体用法?Java ComponentPeer.setFont怎么用?Java ComponentPeer.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.peer.ComponentPeer的用法示例。


在下文中一共展示了ComponentPeer.setFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * Validates this component.
 * <p>
 * The meaning of the term <i>validating</i> is defined by the ancestors of
 * this class. See {@link Container#validate} for more details.
 *
 * @see       #invalidate
 * @see       #doLayout()
 * @see       LayoutManager
 * @see       Container#validate
 * @since     JDK1.0
 */
public void validate() {
    synchronized (getTreeLock()) {
        ComponentPeer peer = this.peer;
        boolean wasValid = isValid();
        if (!wasValid && peer != null) {
            Font newfont = getFont();
            Font oldfont = peerFont;
            if (newfont != oldfont && (oldfont == null
                                       || !oldfont.equals(newfont))) {
                peer.setFont(newfont);
                peerFont = newfont;
            }
            peer.layout();
        }
        valid = true;
        if (!wasValid) {
            mixOnValidating();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:Component.java

示例2: validate

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * Validates this component.
 * <p>
 * The meaning of the term <i>validating</i> is defined by the ancestors of
 * this class. See {@link Container#validate} for more details.
 *
 * @see       #invalidate
 * @see       #doLayout()
 * @see       LayoutManager
 * @see       Container#validate
 * @since     1.0
 */
public void validate() {
    synchronized (getTreeLock()) {
        ComponentPeer peer = this.peer;
        boolean wasValid = isValid();
        if (!wasValid && peer != null) {
            Font newfont = getFont();
            Font oldfont = peerFont;
            if (newfont != oldfont && (oldfont == null
                                       || !oldfont.equals(newfont))) {
                peer.setFont(newfont);
                peerFont = newfont;
            }
            peer.layout();
        }
        valid = true;
        if (!wasValid) {
            mixOnValidating();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:Component.java

示例3: setFont

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * Sets the font of this component.
 * <p>
 * This method changes layout-related information, and therefore,
 * invalidates the component hierarchy.
 *
 * @param f the font to become this component's font;
 *          if this parameter is <code>null</code> then this
 *          component will inherit the font of its parent
 * @see #getFont
 * @see #invalidate
 * @since JDK1.0
 * @beaninfo
 *       bound: true
 */
public void setFont(Font f) {
    Font oldFont, newFont;
    synchronized(getTreeLock()) {
        oldFont = font;
        newFont = font = f;
        ComponentPeer peer = this.peer;
        if (peer != null) {
            f = getFont();
            if (f != null) {
                peer.setFont(f);
                peerFont = f;
            }
        }
    }
    // This is a bound property, so report the change to
    // any registered listeners.  (Cheap if there are none.)
    firePropertyChange("font", oldFont, newFont);

    // This could change the preferred size of the Component.
    // Fix for 6213660. Should compare old and new fonts and do not
    // call invalidate() if they are equal.
    if (f != oldFont && (oldFont == null ||
                                  !oldFont.equals(f))) {
        invalidateIfValid();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:Component.java

示例4: setFont

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * Sets the font of this component.
 * <p>
 * This method changes layout-related information, and therefore,
 * invalidates the component hierarchy.
 *
 * @param f the font to become this component's font;
 *          if this parameter is {@code null} then this
 *          component will inherit the font of its parent
 * @see #getFont
 * @see #invalidate
 * @since 1.0
 */
public void setFont(Font f) {
    Font oldFont, newFont;
    synchronized(getTreeLock()) {
        oldFont = font;
        newFont = font = f;
        ComponentPeer peer = this.peer;
        if (peer != null) {
            f = getFont();
            if (f != null) {
                peer.setFont(f);
                peerFont = f;
            }
        }
    }
    // This is a bound property, so report the change to
    // any registered listeners.  (Cheap if there are none.)
    firePropertyChange("font", oldFont, newFont);

    // This could change the preferred size of the Component.
    // Fix for 6213660. Should compare old and new fonts and do not
    // call invalidate() if they are equal.
    if (f != oldFont && (oldFont == null ||
                                  !oldFont.equals(f))) {
        invalidateIfValid();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:Component.java


注:本文中的java.awt.peer.ComponentPeer.setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。