Пример #1
0
  /**
   * Called to draw the panel.
   *
   * @param g Graphics device to draw the panel to.
   */
  public void paintComponent(Graphics g) {
    final Point scrollPosition = getScrollPosition();
    g.translate(-scrollPosition.x, -scrollPosition.y);

    try {
      super.paintComponent(g);
    } finally {
      g.translate(scrollPosition.x, scrollPosition.y);
    }
  }