@Override
    protected void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g.create();
        if (isEnabled()) {
            g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            if (hover) {
                if (imageHover != null) {
                    g2.drawImage(imageHover.getScaledInstance(getHeight(), getWidth(), Image.SCALE_DEFAULT), 0, 0, getWidth(), getHeight(), this);
                    g2.drawString(getText(), getWidth()-15, getHeight() -10);
                }
                if (colorHover != null) {
                    setBackground(colorHover);
                    setForeground(color);
                    super.paintComponent(g);
                }
            } else {
                if (color != null) {
                    setBackground(color);
                    setForeground(colorHover);
                    super.paintComponent(g);
                } else {
                    g2.drawImage(image.getScaledInstance(getHeight(), getWidth(), Image.SCALE_DEFAULT), 0, 0, getWidth(), getHeight(), this);
                    g2.drawString(getText(), getWidth()-15, getHeight() -10);
                }
            }
            g2.dispose();
        } else {
            if (imageHover != null)
                g2.drawImage(imageHover.getScaledInstance(getHeight(), getWidth(), Image.SCALE_DEFAULT), 0, 0, getWidth(), getHeight(), this);
            else if (colorHover != null) {
                setBackground(colorHover);
                setForeground(color);
                super.paintComponent(g);
            }else
                super.paintComponent(g);
        }

    }