code: @Override
     public void paint(Graphics g, JComponent c) {
        Graphics2D g2 = (Graphics2D) g.create();
        if (clockwiseRotation) {
           g2.rotate(Math.PI / 2, c.getSize().width / 2, c.getSize().width / 2);
        } else {
           g2.rotate(-Math.PI / 2, c.getSize().height / 2, c.getSize().height / 2);
        }
        super.paint(g2, c);
     }
docs: Transforms the Graphics for vertical rendering and invokes the
  super method.