Ejemplo n.º 1
0
        internal virtual void RemoveNotify()
        {
            TrayIconPeer p = null;

            lock (this)
            {
                p    = Peer;
                Peer = null;
            }
            if (p != null)
            {
                p.Dispose();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Displays a popup message near the tray icon.  The message will
        /// disappear after a time or if the user clicks on it.  Clicking
        /// on the message may trigger an {@code ActionEvent}.
        ///
        /// <para>Either the caption or the text may be <code>null</code>, but an
        /// <code>NullPointerException</code> is thrown if both are
        /// <code>null</code>.
        ///
        /// When displayed, the caption or text strings may be truncated on
        /// some platforms; the number of characters that may be displayed is
        /// platform-dependent.
        ///
        /// </para>
        /// <para><strong>Note:</strong> Some platforms may not support
        /// showing a message.
        ///
        /// </para>
        /// </summary>
        /// <param name="caption"> the caption displayed above the text, usually in
        /// bold; may be <code>null</code> </param>
        /// <param name="text"> the text displayed for the particular message; may be
        /// <code>null</code> </param>
        /// <param name="messageType"> an enum indicating the message type </param>
        /// <exception cref="NullPointerException"> if both <code>caption</code>
        /// and <code>text</code> are <code>null</code> </exception>
        public virtual void DisplayMessage(String caption, String text, MessageType messageType)
        {
            if (caption == null && text == null)
            {
                throw new NullPointerException("displaying the message with both caption and text being null");
            }

            TrayIconPeer peer = this.Peer;

            if (peer != null)
            {
                peer.DisplayMessage(caption, text, messageType.name());
            }
        }
Ejemplo n.º 3
0
        // ****************************************************************
        // ****************************************************************

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void addNotify() throws AWTException
        internal virtual void AddNotify()
        {
            lock (this)
            {
                if (Peer == null)
                {
                    Toolkit toolkit = Toolkit.DefaultToolkit;
                    if (toolkit is SunToolkit)
                    {
                        Peer = ((SunToolkit)Toolkit.DefaultToolkit).createTrayIcon(this);
                    }
                    else if (toolkit is HeadlessToolkit)
                    {
                        Peer = ((HeadlessToolkit)Toolkit.DefaultToolkit).createTrayIcon(this);
                    }
                }
            }
            Peer.ToolTip = Tooltip;
        }