public void render(Graphics2D origG, int renderHintType,
                       float totalRotation, float userZoom,
                       boolean tabSelected) {
        if (!allowScreenOrPrintRenderingOrInteraction())
            return;
        if (renderHintType == GraphicsRenderingHints.SCREEN && !allowScreenNormalMode())
            return;
        if (renderHintType == GraphicsRenderingHints.PRINT && !allowPrintNormalMode())
            return;

//System.out.println("render(-)  " + this);
        Rectangle2D.Float rect = getUserSpaceRectangle();
// Show original ractangle, without taking into consideration NoZoom and NoRotate
//System.out.println("Original rectangle: " + rect);
//origG.setColor( Color.blue );
//origG.draw( rect );
//origG.setColor( Color.red );
//Line2D.Double topLine = new Line2D.Double( rect.getMinX(), rect.getMaxY(), rect.getMaxX(), rect.getMaxY() );
//origG.draw( topLine );
//origG.setColor( Color.yellow );
//Line2D.Double bottomLine = new Line2D.Double( rect.getMinX(), rect.getMinY(), rect.getMaxX(), rect.getMinY() );
//origG.draw( bottomLine );

        AffineTransform oldAT = origG.getTransform();
        Shape oldClip = origG.getClip();

        // Simply uncomment the //// lines to use a different Graphics object
        Graphics2D g = origG;
        ////Graphics2D g = (Graphics2D) origG.create();

        AffineTransform at = new AffineTransform(oldAT);
        at.translate(rect.getMinX(), rect.getMinY());

        boolean noRotate = getFlagNoRotate();
        if (noRotate) {
            float unRotation = -totalRotation;
            while (unRotation < 0.0f)
                unRotation += 360.0f;
            while (unRotation > 360.0f)
                unRotation -= 360.0f;
            if (unRotation == -0.0f)
                unRotation = 0.0f;

            if (unRotation != 0.0) {
                double radians = Math.toRadians(unRotation); // unRotation * Math.PI / 180.0
                AffineTransform rotationTransform =
                        AffineTransform.getRotateInstance(radians);
                Point2D.Double origTopLeftCorner = new Point2D.Double(0.0, Math.abs(rect.getHeight()));
                Point2D rotatedTopLeftCorner = rotationTransform.transform(origTopLeftCorner, null);
                at.translate(origTopLeftCorner.getX() - rotatedTopLeftCorner.getX(),
                        origTopLeftCorner.getY() - rotatedTopLeftCorner.getY());
                at.rotate(radians);
            }
        }

        boolean noZoom = getFlagNoZoom();
        if (noZoom) {
            double scaleY = Math.abs(at.getScaleY());
            if (scaleY != 1.0) {
                double scaleX = Math.abs(at.getScaleX());
                double rectHeight = Math.abs(rect.getHeight());
                double resizedY = rectHeight * ((scaleY - 1.0) / scaleY);
                at.translate(0.0, resizedY);
                at.scale(1.0 / scaleX, 1.0 / scaleY);
            }
        }

        GraphicsRenderingHints grh = GraphicsRenderingHints.getDefault();
        g.setRenderingHints(grh.getRenderingHints(renderHintType));
        g.setTransform(at);
        Shape preAppearanceStreamClip = g.getClip();
        g.clip(deriveDrawingRectangle());

        renderAppearanceStream(g);

        g.setTransform(at);
        g.setClip(preAppearanceStreamClip);

        if (tabSelected) {
            renderBorderTabSelected(g);
        } else {
            renderBorder(g);
        }

        g.setTransform(oldAT);
        g.setClip(oldClip);

        ////g.dispose();

// Show the top left corner, that NoZoom and NoRotate annotations cling to
//origG.setColor( Color.blue );
//Rectangle2D.Double topLeft = new Rectangle2D.Double(
//    rect.getMinX(), rect.getMaxY()-3, 3, 3 );
//origG.fill( topLeft );
    }