public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    TabbedPanel tabbedPanel = TabbedUtils.getParentTabbedPanel(c);

    if (tabbedPanel != null) {
      Direction d = tabbedPanel.getProperties().getTabAreaOrientation();
      g.setColor(color.getColor(c));

      if (d == Direction.UP) {
        GraphicsUtil.drawOptimizedLine(g, x + 1, y, x + width - 2, y);
        GraphicsUtil.drawOptimizedLine(g, x, y, x, y + height - (openBorder ? 1 : 2));
      }
      else if (d == Direction.LEFT) {
        GraphicsUtil.drawOptimizedLine(g, x + 1, y, x + width - (openBorder ? 1 : 2), y);
        GraphicsUtil.drawOptimizedLine(g, x, y, x, y + height - 2);
      }
      else if (d == Direction.DOWN) {
        if (!openBorder)
          GraphicsUtil.drawOptimizedLine(g, x + 1, y, x + width - 2, y);
        GraphicsUtil.drawOptimizedLine(g, x, y, x, y + height - 2);
      }
      else {
        if (openBorder)
          GraphicsUtil.drawOptimizedLine(g, x, y, x + width - 2, y);
        else {
          GraphicsUtil.drawOptimizedLine(g, x + 1, y, x + width - 2, y);
          GraphicsUtil.drawOptimizedLine(g, x, y, x, y + height - 2);
        }
      }
    }
  }