/** * 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); } }
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); } }
/** * 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); } }
/** * 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); }
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); }
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); } } }
/** * 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; }
private static PropertyChangeSupport createPropertyChangeSupport(Toolkit toolkit) { if (toolkit instanceof SunToolkit || toolkit instanceof HeadlessToolkit) { return new DesktopPropertyChangeSupport(toolkit); } else { return new PropertyChangeSupport(toolkit); } }
@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"; }
public static IkvmToolkit get() { Toolkit tk = Toolkit.getDefaultToolkit(); if (tk instanceof HeadlessToolkit) { tk = ((HeadlessToolkit)tk).getUnderlyingToolkit(); } return (IkvmToolkit)tk; }