class CloseTabIcon implements Icon {

    /**
     * the x position of the icon
     */
    private int x_pos;
    /**
     * the y position of the icon
     */
    private int y_pos;
    /**
     * the width the icon
     */
    private final int width;
    /**
     * the height the icon
     */
    private final int height;
    /**
     * the additional fileicon
     */
    private final Icon fileIcon;
    /**
     * true whether the mouse is over this icon, false otherwise
     */
    private boolean mouseover = false;
    /**
     * true whether the mouse is pressed on this icon, false otherwise
     */
    private boolean mousepressed = false;

    /**
     * Creates a new instance of
     * <code>CloseTabIcon</code>
     *
     * @param fileIcon the additional fileicon, if there is one set
     */
    public CloseTabIcon(Icon fileIcon) {
      this.fileIcon = fileIcon;
      width = 16;
      height = 16;
    }

    /**
     * Draw the icon at the specified location. Icon implementations may use the Component argument
     * to get properties useful for painting, e.g. the foreground or background color.
     *
     * @param c the component which the icon belongs to
     * @param g the graphic object to draw on
     * @param x the upper left point of the icon in the x direction
     * @param y the upper left point of the icon in the y direction
     */
    public void paintIcon(Component c, Graphics g, int x, int y) {<FILL_FUNCTION_BODY>}

    /**
     * Returns the icon's width.
     *
     * @return an int specifying the fixed width of the icon.
     */
    public int getIconWidth() {
      return width + (fileIcon != null ? fileIcon.getIconWidth() : 0);
    }

    /**
     * Returns the icon's height.
     *
     * @return an int specifying the fixed height of the icon.
     */
    public int getIconHeight() {
      return height;
    }

    /**
     * Gets the bounds of this icon in the form of a
     * <code>Rectangle<code>
     * object. The bounds specify this icon's width, height, and location
     * relative to its parent.
     *
     * @return a rectangle indicating this icon's bounds
     */
    public Rectangle getBounds() {
      return new Rectangle(x_pos, y_pos, width, height);
    }
  }

      boolean doPaintCloseIcon = true;
      try {
        // JComponent.putClientProperty("isClosable", new Boolean(false));
        JTabbedPane tabbedpane = (JTabbedPane) c;
        int tabNumber = tabbedpane.getUI().tabForCoordinate(tabbedpane, x, y);
        JComponent curPanel = (JComponent) tabbedpane.getComponentAt(tabNumber);
        Object prop = curPanel.getClientProperty("isClosable");
        if (prop != null) {
          doPaintCloseIcon = (Boolean) prop;
        }
      } catch (Exception ignored) {/*Could probably be a ClassCastException*/

      }
      if (doPaintCloseIcon) {
        x_pos = x;
        y_pos = y;
        int y_p = y + 1;

        if (normalCloseIcon != null && !mouseover) {
          normalCloseIcon.paintIcon(c, g, x, y_p);
        } else if (hooverCloseIcon != null && mouseover && !mousepressed) {
          hooverCloseIcon.paintIcon(c, g, x, y_p);
        } else if (pressedCloseIcon != null && mousepressed) {
          pressedCloseIcon.paintIcon(c, g, x, y_p);
        } else {
          y_p++;

          Color col = g.getColor();

          if (mousepressed && mouseover) {
            g.setColor(Color.WHITE);
            g.fillRect(x + 1, y_p, 12, 13);
          }

          g.setColor(Color.GRAY);
          /*
           g.drawLine(x+1, y_p, x+12, y_p);
           g.drawLine(x+1, y_p+13, x+12, y_p+13);
           g.drawLine(x, y_p+1, x, y_p+12);
           g.drawLine(x+13, y_p+1, x+13, y_p+12);
           g.drawLine(x+3, y_p+3, x+10, y_p+10);
           */
          if (mouseover) {
            g.setColor(Color.RED);
          }
          g.drawLine(x + 3, y_p + 4, x + 9, y_p + 10);
          g.drawLine(x + 4, y_p + 3, x + 10, y_p + 9);
          g.drawLine(x + 10, y_p + 3, x + 3, y_p + 10);
          g.drawLine(x + 10, y_p + 4, x + 4, y_p + 10);
          g.drawLine(x + 9, y_p + 3, x + 3, y_p + 9);
          g.setColor(col);
          if (fileIcon != null) {
            fileIcon.paintIcon(c, g, x + width, y_p);
          }
        }
      }
    
<methods>public void <init>() ,public void <init>(int) ,public void <init>(int, int) ,public java.awt.Component add(java.awt.Component) ,public java.awt.Component add(java.lang.String, java.awt.Component) ,public java.awt.Component add(java.awt.Component, int) ,public void add(java.awt.Component, java.lang.Object) ,public void add(java.awt.Component, java.lang.Object, int) ,public void addChangeListener(javax.swing.event.ChangeListener) ,public void addTab(java.lang.String, java.awt.Component) ,public void addTab(java.lang.String, javax.swing.Icon, java.awt.Component) ,public void addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.awt.Color getBackgroundAt(int) ,public java.awt.Rectangle getBoundsAt(int) ,public javax.swing.event.ChangeListener[] getChangeListeners() ,public java.awt.Component getComponentAt(int) ,public javax.swing.Icon getDisabledIconAt(int) ,public int getDisplayedMnemonicIndexAt(int) ,public java.awt.Color getForegroundAt(int) ,public javax.swing.Icon getIconAt(int) ,public int getMnemonicAt(int) ,public javax.swing.SingleSelectionModel getModel() ,public java.awt.Component getSelectedComponent() ,public int getSelectedIndex() ,public java.awt.Component getTabComponentAt(int) ,public int getTabCount() ,public int getTabLayoutPolicy() ,public int getTabPlacement() ,public int getTabRunCount() ,public java.lang.String getTitleAt(int) ,public java.lang.String getToolTipText(java.awt.event.MouseEvent) ,public java.lang.String getToolTipTextAt(int) ,public javax.swing.plaf.TabbedPaneUI getUI() ,public java.lang.String getUIClassID() ,public int indexAtLocation(int, int) ,public int indexOfComponent(java.awt.Component) ,public int indexOfTab(java.lang.String) ,public int indexOfTab(javax.swing.Icon) ,public int indexOfTabComponent(java.awt.Component) ,public void insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) ,public boolean isEnabledAt(int) ,public void remove(java.awt.Component) ,public void remove(int) ,public void removeAll() ,public void removeChangeListener(javax.swing.event.ChangeListener) ,public void removeTabAt(int) ,public void setBackgroundAt(int, java.awt.Color) ,public void setComponentAt(int, java.awt.Component) ,public void setDisabledIconAt(int, javax.swing.Icon) ,public void setDisplayedMnemonicIndexAt(int, int) ,public void setEnabledAt(int, boolean) ,public void setForegroundAt(int, java.awt.Color) ,public void setIconAt(int, javax.swing.Icon) ,public void setMnemonicAt(int, int) ,public void setModel(javax.swing.SingleSelectionModel) ,public void setSelectedComponent(java.awt.Component) ,public void setSelectedIndex(int) ,public void setTabComponentAt(int, java.awt.Component) ,public void setTabLayoutPolicy(int) ,public void setTabPlacement(int) ,public void setTitleAt(int, java.lang.String) ,public void setToolTipTextAt(int, java.lang.String) ,public void setUI(javax.swing.plaf.TabbedPaneUI) ,public void updateUI() <variables>public static final int SCROLL_TAB_LAYOUT,public static final int WRAP_TAB_LAYOUT,protected transient javax.swing.event.ChangeEvent changeEvent,protected javax.swing.event.ChangeListener changeListener,private boolean haveRegistered,protected javax.swing.SingleSelectionModel model,private List<javax.swing.JTabbedPane.Page> pages,private int tabLayoutPolicy,protected int tabPlacement,private static final java.lang.String uiClassID,private java.awt.Component visComp