sun.awt.HeadlessToolkit Java Examples

The following examples show how to use sun.awt.HeadlessToolkit. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Toolkit.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #2
Source File: Toolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #3
Source File: Toolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #4
Source File: Toolkit.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #5
Source File: Toolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #6
Source File: Toolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #7
Source File: Toolkit.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #8
Source File: Toolkit.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example #9
Source File: Toolkit.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #10
Source File: Toolkit.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #11
Source File: Toolkit.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #12
Source File: Toolkit.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example #13
Source File: Toolkit.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #14
Source File: Toolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #15
Source File: Toolkit.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #16
Source File: Toolkit.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #17
Source File: Toolkit.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #18
Source File: Toolkit.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #19
Source File: Toolkit.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #20
Source File: Toolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #21
Source File: Toolkit.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
    }
}
 
Example #22
Source File: Toolkit.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #23
Source File: Toolkit.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
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);
    }
}
 
Example #24
Source File: SystemTray.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #25
Source File: Toolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: SystemTray.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #27
Source File: SystemTray.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #28
Source File: CFontManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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";
}
 
Example #29
Source File: TrayIcon.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #30
Source File: TrayIcon.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}