@Override
    public void paintComponent(Graphics g) {
      super.paintComponent(g);

      Graphics2D g2d = (Graphics2D)g;
      if (!myReferencePainter.isLeftAligned()) {
        int start = Math.max(myGraphWidth, getWidth() - myReferencePainter.getSize().width);
        myReferencePainter.paint(g2d, start, 0, getHeight());
      }
      else {
        myReferencePainter.paint(g2d, myGraphWidth, 0, getHeight());
      }
      myPainter.paint(g2d, myPrintElements);
    }
@Override
    public void paintComponent(Graphics g)