Class ClosingIcon

  • All Implemented Interfaces:
    javax.swing.Icon

    public class ClosingIcon
    extends java.lang.Object
    implements javax.swing.Icon
    the idea for this class stems from limewire's CancelSearchIconProxy class, thanks for going open source guys.
    • Constructor Summary

      Constructors 
      Constructor Description
      ClosingIcon​(@NotNull javax.swing.Icon icon)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(int xEvent, int yEvent)
      Returns whether xEvent and yEvent are within the icon's borders.
      int getIconHeight()  
      int getIconWidth()  
      void paintIcon​(@NotNull java.awt.Component c, @NotNull java.awt.Graphics g, int x, int y)
      Overwrites paintIcon to get hold of the coordinates of the icon, this is a rather rude approach just to find out if the closingIcon was pressed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClosingIcon

        public ClosingIcon​(@NotNull
                           @NotNull javax.swing.Icon icon)
    • Method Detail

      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
      • paintIcon

        public void paintIcon​(@NotNull
                              @NotNull java.awt.Component c,
                              @NotNull
                              @NotNull java.awt.Graphics g,
                              int x,
                              int y)
        Overwrites paintIcon to get hold of the coordinates of the icon, this is a rather rude approach just to find out if the closingIcon was pressed.
        Specified by:
        paintIcon in interface javax.swing.Icon
      • contains

        public boolean contains​(int xEvent,
                                int yEvent)
        Returns whether xEvent and yEvent are within the icon's borders.
        Parameters:
        xEvent - the x coordinate from an event
        yEvent - the y coordinate from an event
        Returns:
        whether xEvent and yEvent are within the icon's borders
        Return Value:
        true if xEvent and yEvent are within the icon's border., false otherwise (xEvent or yEvent or both are outside the icon's border).