@Override
  protected void paintBackground(Graphics g, JComponent component) {
    getGlassParameters();
    Graphics2D g2d = (Graphics2D) g.create();

    if (getOrientation().isHorizontal()) {
      paintBackground(
          g2d,
          0,
          0,
          component.getWidth(),
          component.getHeight(),
          getOrientation().isHorizontal(),
          component);
    } else {
      paintBackground(
          g2d,
          0,
          0,
          component.getHeight(),
          component.getWidth(),
          getOrientation().isHorizontal(),
          component);
    }

    g2d.dispose();
  }
  protected void paintBackground(
      Graphics g, int x, int y, int w, int h, boolean horizontal, JComponent component) {
    Graphics2D g2d = (Graphics2D) g.create();
    CEclipseBorder ec = null;
    Insets ins = getOutsideInsets();

    x = ins.left;
    y = ins.top;
    if (getOrientation().isHorizontal()) {
      w -= ins.left + ins.right;
      h -= ins.top + ins.bottom;
    } else {
      w -= ins.top + ins.bottom;
      h -= ins.left + ins.right;
    }

    if (component.getBorder() instanceof CompoundBorder) {
      CompoundBorder cb = (CompoundBorder) component.getBorder();
      CompoundBorder bb = (CompoundBorder) cb.getInsideBorder();

      ec = (CEclipseBorder) bb.getOutsideBorder();
    }

    if (w > 0 && h > 0) {
      if (glassStrip != null) {
        BufferedImage im = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);

        Graphics2D gg = im.createGraphics();
        gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        gg.setColor(component.getBackground());
        if (ec != null) {
          gg.fill(ec.createShape(0, 0, w, h, ec.getCornerRadius()));

        } else {
          gg.fillRect(0, 0, w, h);
        }

        if (!isSelected()) {
          gg.setComposite(AlphaComposite.SrcIn);
        } else {
          gg.setComposite(AlphaComposite.SrcAtop);
        }

        try {
          glass.Render2Graphics(new Dimension(w, h), gg, glassStrip, true);
        } catch (Exception e) {
          glass.Render2Graphics(new Dimension(w, h), gg, CGlassFactory.VALUE_STEEL, true);
        }

        gg.dispose();

        if (!getOrientation().isHorizontal()) {
          AffineTransform atTrans = AffineTransform.getTranslateInstance(x /* + h */, y + w);
          atTrans.concatenate(COutlineHelper.tRot90CCW);
          g2d.drawImage(im, atTrans, null);
        } else {
          g2d.drawImage(im, x, y, null);
        }
      }

      g2d.dispose();
    }
  }
  @Override
  protected void paintForeground(Graphics g, JComponent component) {
    // paint icon (if there is any)
    paintIcon(g, component);

    Insets ins = getOutsideInsets();

    int w = component.getWidth();
    int h = component.getHeight();

    // paint knob (if there is any)
    // TODO colors
    if (behavior.isShowKnob()) {
      Insets insets = getInnerInsets();

      if (getOrientation().isHorizontal()) {
        int x = ins.left + insets.left - KNOB_SIZE + 3;
        int y1 = ins.top + insets.top + 3;
        int y2 = h - insets.bottom - ins.bottom - 4;

        g.setColor(Color.WHITE);
        g.drawLine(x, y1, x, y2);
        g.drawLine(x, y1, x + 1, y1);

        g.setColor(Color.DARK_GRAY);
        g.drawLine(x, y2, x + 1, y2);
        g.drawLine(x + 1, y1 + 1, x + 1, y2);
      } else {
        int y = ins.top + insets.top - KNOB_SIZE + 3;
        int x1 = ins.left + insets.left + 3;
        int x2 = w - insets.right - ins.right - 4;

        g.setColor(Color.WHITE);
        g.drawLine(x1, y, x2, y);
        g.drawLine(x1, y, x1, y + 1);

        g.setColor(Color.DARK_GRAY);
        g.drawLine(x1 + 1, y + 1, x2, y + 1);
        g.drawLine(x2, y, x2, y + 1);
      }
    }
  }