本文整理汇总了Java中sun.awt.HeadlessToolkit类的典型用法代码示例。如果您正苦于以下问题:Java HeadlessToolkit类的具体用法?Java HeadlessToolkit怎么用?Java HeadlessToolkit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HeadlessToolkit类属于sun.awt包,在下文中一共展示了HeadlessToolkit类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDesktopProperty
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
/**
* Sets the named desktop property to the specified value and fires a
* property change event to notify any listeners that the value has changed.
*/
protected final void setDesktopProperty(String name, Object newValue) {
// This is a workaround for headless toolkits. It would be
// better to override this method but it is declared final.
// "this instanceof" syntax defeats polymorphism.
// --mm, 03/03/00
if (this instanceof HeadlessToolkit) {
((HeadlessToolkit)this).getUnderlyingToolkit()
.setDesktopProperty(name, newValue);
return;
}
Object oldValue;
synchronized (this) {
oldValue = desktopProperties.get(name);
desktopProperties.put(name, newValue);
}
// Don't fire change event if old and new values are null.
// It helps to avoid recursive resending of WM_THEMECHANGED
if (oldValue != null || newValue != null) {
desktopPropsSupport.firePropertyChange(name, oldValue, newValue);
}
}
示例2: notifyAWTEventListeners
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
void notifyAWTEventListeners(AWTEvent theEvent) {
// This is a workaround for headless toolkits. It would be
// better to override this method but it is declared package private.
// "this instanceof" syntax defeats polymorphism.
// --mm, 03/03/00
if (this instanceof HeadlessToolkit) {
((HeadlessToolkit)this).getUnderlyingToolkit()
.notifyAWTEventListeners(theEvent);
return;
}
AWTEventListener eventListener = this.eventListener;
if (eventListener != null) {
eventListener.eventDispatched(theEvent);
}
}
示例3: setDesktopProperty
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
/**
* Sets the named desktop property to the specified value and fires a
* property change event to notify any listeners that the value has changed.
*
* @param name the property name
* @param newValue the new property value
*/
protected final void setDesktopProperty(String name, Object newValue) {
// This is a workaround for headless toolkits. It would be
// better to override this method but it is declared final.
// "this instanceof" syntax defeats polymorphism.
// --mm, 03/03/00
if (this instanceof HeadlessToolkit) {
((HeadlessToolkit)this).getUnderlyingToolkit()
.setDesktopProperty(name, newValue);
return;
}
Object oldValue;
synchronized (this) {
oldValue = desktopProperties.get(name);
desktopProperties.put(name, newValue);
}
// Don't fire change event if old and new values are null.
// It helps to avoid recursive resending of WM_THEMECHANGED
if (oldValue != null || newValue != null) {
desktopPropsSupport.firePropertyChange(name, oldValue, newValue);
}
}
示例4: setDesktopProperty
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
/**
* Sets the named desktop property to the specified value and fires a
* property change event to notify any listeners that the value has changed.
*/
protected final void setDesktopProperty(String name, Object newValue) {
// This is a workaround for headless toolkits. It would be
// better to override this method but it is declared final.
// "this instanceof" syntax defeats polymorphism.
// --mm, 03/03/00
if (this instanceof HeadlessToolkit) {
((HeadlessToolkit)this).getUnderlyingToolkit()
.setDesktopProperty(name, newValue);
return;
}
Object oldValue;
synchronized (this) {
oldValue = desktopProperties.get(name);
desktopProperties.put(name, newValue);
}
desktopPropsSupport.firePropertyChange(name, oldValue, newValue);
}
示例5: notifyAWTEventListeners
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
void notifyAWTEventListeners(AWTEvent theEvent) {
// This is a workaround for headless toolkits. It would be
// better to override this method but it is declared package private.
// "this instanceof" syntax defeats polymorphism.
// --mm, 03/03/00
if (this instanceof HeadlessToolkit) {
((HeadlessToolkit)this).getUnderlyingToolkit()
.notifyAWTEventListeners(theEvent);
return;
}
AWTEventListener eventListener = this.eventListener;
if (eventListener != null) {
eventListener.eventDispatched(theEvent);
}
}
示例6: addNotify
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
void addNotify()
throws AWTException
{
synchronized (this) {
if (peer == null) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof SunToolkit) {
peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createTrayIcon(this);
} else if (toolkit instanceof HeadlessToolkit) {
peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createTrayIcon(this);
}
}
}
peer.setToolTip(tooltip);
}
示例7: addNotify
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
synchronized void addNotify() {
if (peer == null) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof SunToolkit) {
peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this);
} else if (toolkit instanceof HeadlessToolkit) {
peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this);
}
}
}
示例8: getDesktopProperty
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
/**
* Obtains a value for the specified desktop property.
*
* A desktop property is a uniquely named value for a resource that
* is Toolkit global in nature. Usually it also is an abstract
* representation for an underlying platform dependent desktop setting.
* For more information on desktop properties supported by the AWT see
* <a href="doc-files/DesktopProperties.html">AWT Desktop Properties</a>.
*/
public final synchronized Object getDesktopProperty(String propertyName) {
// This is a workaround for headless toolkits. It would be
// better to override this method but it is declared final.
// "this instanceof" syntax defeats polymorphism.
// --mm, 03/03/00
if (this instanceof HeadlessToolkit) {
return ((HeadlessToolkit)this).getUnderlyingToolkit()
.getDesktopProperty(propertyName);
}
if (desktopProperties.isEmpty()) {
initializeDesktopProperties();
}
Object value;
// This property should never be cached
if (propertyName.equals("awt.dynamicLayoutSupported")) {
return getDefaultToolkit().lazilyLoadDesktopProperty(propertyName);
}
value = desktopProperties.get(propertyName);
if (value == null) {
value = lazilyLoadDesktopProperty(propertyName);
if (value != null) {
setDesktopProperty(propertyName, value);
}
}
/* for property "awt.font.desktophints" */
if (value instanceof RenderingHints) {
value = ((RenderingHints)value).clone();
}
return value;
}
示例9: createPropertyChangeSupport
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
private static PropertyChangeSupport createPropertyChangeSupport(Toolkit toolkit) {
if (toolkit instanceof SunToolkit || toolkit instanceof HeadlessToolkit) {
return new DesktopPropertyChangeSupport(toolkit);
} else {
return new PropertyChangeSupport(toolkit);
}
}
示例10: getFontPath
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
@Override
public String getFontPath(boolean noType1Fonts) {
// In the case of the Cocoa toolkit, since we go through NSFont, we don't need to register /Library/Fonts
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof HeadlessToolkit) {
tk = ((HeadlessToolkit)tk).getUnderlyingToolkit();
}
if (tk instanceof LWCToolkit) {
return "";
}
// X11 case
return "/Library/Fonts";
}
示例11: get
import sun.awt.HeadlessToolkit; //导入依赖的package包/类
public static IkvmToolkit get()
{
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof HeadlessToolkit)
{
tk = ((HeadlessToolkit)tk).getUnderlyingToolkit();
}
return (IkvmToolkit)tk;
}