Exemplo n.º 1
0
  public void redraw() {
    // update the title of the GUI
    if (getCustomTitle() == null) {
      int id = manager.getWindowIndex(this);
      if (id != 0) setTitle(getTitle() + " (view " + (id + 1) + ")");
      else setTitle(getTitle());
    }

    stepPanZoomAnimation();

    synchronized (imgLock) {
      // redraw the scene
      manager.preRedraw(this);
      manager.redraw(this);

      // copy the image buffer into the JLabel on the JFrame
      Graphics cg = lblCanvas.getGraphics();
      if (cg != null) cg.drawImage(img, 0, 0, null);

      // save a screenshot if one was requested
      if (saveScreenshotName != null) {
        try {
          ImageIO.write(img, "png", new java.io.File(saveScreenshotName));
        } catch (java.io.IOException e) {
          DialogHelper.displayError("Screenshot could not be saved: " + e);
        }
        saveScreenshotName = null;
      }
    }
  }
Exemplo n.º 2
0
 public void componentResized(ComponentEvent e) {
   // handle the window being resized
   setMySize(getWidth(), getHeight());
   manager.windowResized(this);
 }