本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}