Esempio n. 1
0
  public static void main(final String[] args) throws AWTException {
    final boolean dump = Boolean.parseBoolean(args[0]);
    final Window w =
        new Frame() {
          @Override
          public void list(final PrintStream out, final int indent) {
            super.list(out, indent);
            dumped = true;
          }
        };
    w.setSize(200, 200);
    w.setLocationRelativeTo(null);
    w.setVisible(true);

    final Robot robot = new Robot();
    robot.setAutoDelay(50);
    robot.setAutoWaitForIdle(true);
    robot.mouseMove(w.getX() + w.getWidth() / 2, w.getY() + w.getHeight() / 2);
    robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_SHIFT);
    robot.keyPress(KeyEvent.VK_F1);
    robot.keyRelease(KeyEvent.VK_F1);
    robot.keyRelease(KeyEvent.VK_SHIFT);
    robot.keyRelease(KeyEvent.VK_CONTROL);

    w.dispose();
    if (dumped != dump) {
      throw new RuntimeException("Exp:" + dump + ", actual:" + dumped);
    }
  }
Esempio n. 2
0
 public void mouseDragged(MouseEvent e) {
   Point newPos = e.getPoint();
   SwingUtilities.convertPointToScreen(newPos, SizeGrip.this);
   int xDelta = newPos.x - origPos.x;
   int yDelta = newPos.y - origPos.y;
   Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this);
   if (wind != null) { // Should always be true
     if (getComponentOrientation().isLeftToRight()) {
       int w = wind.getWidth();
       if (newPos.x >= wind.getX()) {
         w += xDelta;
       }
       int h = wind.getHeight();
       if (newPos.y >= wind.getY()) {
         h += yDelta;
       }
       wind.setSize(w, h);
     } else { // RTL
       int newW = Math.max(1, wind.getWidth() - xDelta);
       int newH = Math.max(1, wind.getHeight() + yDelta);
       wind.setBounds(newPos.x, wind.getY(), newW, newH);
     }
     // invalidate()/validate() needed pre-1.6.
     wind.invalidate();
     wind.validate();
   }
   origPos.setLocation(newPos);
 }
Esempio n. 3
0
  /**
   * Tries to load/restore the window state of the given window.
   *
   * @param aNamespace the namespace to use for the window state;
   * @param aProperties the properties to read from;
   * @param aWindow the window to load the state for.
   */
  public static void loadWindowState(final Preferences aProperties, final Window aWindow) {
    // Special case: for FileDialog/JFileChooser we also should restore the
    // properties...
    loadFileDialogState(aProperties, aWindow);

    try {
      final int xPos = aProperties.getInt("winXpos", -1);
      final int yPos = aProperties.getInt("winYpos", -1);
      if ((xPos >= 0) && (yPos >= 0)) {
        aWindow.setLocation(xPos, yPos);
      }
    } catch (NumberFormatException exception) {
      // Ignore...
    }

    if (isNonResizableWindow(aWindow)) {
      // In case the window cannot be resized, don't restore its width &
      // height...
      return;
    }

    try {
      final int width = aProperties.getInt("winWidth", -1);
      final int height = aProperties.getInt("winHeight", -1);
      if ((width >= 0) && (height >= 0)) {
        aWindow.setSize(width, height);
      }
    } catch (NumberFormatException exception) {
      // Ignore...
    }
  }
Esempio n. 4
0
  /**
   * Applies this geometry to a window. Makes sure that the window is not placed outside of the
   * coordinate range of all available screens.
   *
   * @param window the window
   */
  public void applySafe(Window window) {
    Point p = new Point(topLeft);

    Rectangle virtualBounds = new Rectangle();
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    for (GraphicsDevice gd : gs) {
      if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
        virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
      }
    }

    if (p.x < virtualBounds.x) {
      p.x = virtualBounds.x;
    } else if (p.x > virtualBounds.x + virtualBounds.width - extent.width) {
      p.x = virtualBounds.x + virtualBounds.width - extent.width;
    }

    if (p.y < virtualBounds.y) {
      p.y = virtualBounds.y;
    } else if (p.y > virtualBounds.y + virtualBounds.height - extent.height) {
      p.y = virtualBounds.y + virtualBounds.height - extent.height;
    }

    window.setLocation(p);
    window.setSize(extent);
  }
  private void setSizeAndDimensions(
      @NotNull JTable table,
      @NotNull JBPopup popup,
      @NotNull RelativePoint popupPosition,
      @NotNull List<UsageNode> data) {
    JComponent content = popup.getContent();
    Window window = SwingUtilities.windowForComponent(content);
    Dimension d = window.getSize();

    int width = calcMaxWidth(table);
    width = (int) Math.max(d.getWidth(), width);
    Dimension headerSize = ((AbstractPopup) popup).getHeaderPreferredSize();
    width = Math.max((int) headerSize.getWidth(), width);
    width = Math.max(myWidth, width);

    if (myWidth == -1) myWidth = width;
    int newWidth = Math.max(width, d.width + width - myWidth);

    myWidth = newWidth;

    int rowsToShow = Math.min(30, data.size());
    Dimension dimension = new Dimension(newWidth, table.getRowHeight() * rowsToShow);
    Rectangle rectangle = fitToScreen(dimension, popupPosition, table);
    dimension = rectangle.getSize();
    Point location = window.getLocation();
    if (!location.equals(rectangle.getLocation())) {
      window.setLocation(rectangle.getLocation());
    }

    if (!data.isEmpty()) {
      TableScrollingUtil.ensureSelectionExists(table);
    }
    table.setSize(dimension);
    // table.setPreferredSize(dimension);
    // table.setMaximumSize(dimension);
    // table.setPreferredScrollableViewportSize(dimension);

    Dimension footerSize = ((AbstractPopup) popup).getFooterPreferredSize();

    int newHeight =
        (int) (dimension.height + headerSize.getHeight() + footerSize.getHeight())
            + 4 /* invisible borders, margins etc*/;
    Dimension newDim = new Dimension(dimension.width, newHeight);
    window.setSize(newDim);
    window.setMinimumSize(newDim);
    window.setMaximumSize(newDim);

    window.validate();
    window.repaint();
    table.revalidate();
    table.repaint();
  }
Esempio n. 6
0
  public static final void centerWindow(Window win) {
    Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension winDim = win.getSize();

    // System.out.println("[i] Screen: "+screenDim.width+"x"+screenDim.height);
    // System.out.println("[i] WinDim: "+winDim.width+"x"+winDim.height);

    // wenn das Fenster gro���er als der Desktop ist, Fenster auf
    // Desktopgroesse verkleinern
    if (screenDim.width < winDim.width) {
      win.setSize(screenDim.width, winDim.height);
    }
    if (screenDim.height < winDim.height) {
      win.setSize(winDim.width, screenDim.height);
    }
    // Fenster zentrieren
    int x = (screenDim.width - winDim.width) / 2;
    int y = (screenDim.height - winDim.height) / 2;

    System.out.println("[i] setLocation x=" + x + ", y=" + y);
    win.setLocation(x, y);
  }
    public void actionPerformed(ActionEvent ae) {
      Dimension contentSize = null;
      if (w instanceof JDialog) {
        contentSize = ((JDialog) w).getContentPane().getSize();
      } else {
        contentSize = ((JFrame) w).getContentPane().getSize();
      }

      Dimension dialogSize = w.getSize();
      int ydiff = dialogSize.height - contentSize.height;
      Dimension paneSize = pane.getSize();
      w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff));
      w.validate();
      w.repaint();
    }
Esempio n. 8
0
 public static void center(Window frame, int left, int right, int top, int bottom) {
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   Dimension frameSize = frame.getSize();
   if (frameSize.height > (screenSize.height - top - bottom)) {
     frameSize.height = screenSize.height - top - bottom;
   }
   if (frameSize.width > screenSize.width - left - right) {
     frameSize.width = screenSize.width - left - right;
   }
   if (!frameSize.equals(frame.getSize())) {
     frame.setSize(frameSize);
   }
   frame.setLocation(
       left + (screenSize.width - frameSize.width) / 2,
       top + (screenSize.height - frameSize.height) / 2);
 }
 public void setUiVisible(final boolean visible) {
   if (myPopup != null) {
     if (visible) {
       myPopup.show();
       final Window window = getPopupWindow();
       if (window != null && myRestoreWindowSize != null) {
         window.setSize(myRestoreWindowSize);
         myRestoreWindowSize = null;
       }
     } else {
       final Window window = getPopupWindow();
       if (window != null) {
         myRestoreWindowSize = window.getSize();
         window.setVisible(true);
       }
     }
   }
 }
  @Override
  public void pack(boolean width, boolean height) {
    if (!isVisible() || (!width && !height)) return;

    Dimension size = getSize();
    Dimension prefSize = myContent.computePreferredSize();

    if (width) {
      size.width = prefSize.width;
    }

    if (height) {
      size.height = prefSize.height;
    }

    size = computeWindowSize(size);

    final Window window = SwingUtilities.getWindowAncestor(myContent);
    window.setSize(size);
  }
Esempio n. 11
0
  /**
   * Create a frame for this DockPanel. The frame will either be a JFrame or a JDialog depending on
   * the isDialog flag.
   */
  public void createFrame() {

    if (isDialog) {
      frame =
          new JDialog(app.getFrame(), false) {
            private static final long serialVersionUID = 1L;

            // Send window closing event when dialog is set invisible.
            // This allows a dock panel view to close properly.
            @Override
            public void setVisible(boolean isVisible) {
              if (!isVisible && frame != null) {
                windowClosing(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
              }
              super.setVisible(isVisible);
            }
          };
    } else {
      frame = new JFrame(getPlainTitle());
      // needs the higher res as used by Windows 7 for the Toolbar
      ((JFrame) frame).setIconImage(app.getInternalImage("geogebra64.png"));
    }

    frame.addWindowListener(this);

    frame.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent event) {
            setFrameBounds(event.getComponent().getBounds());
          }

          @Override
          public void componentMoved(ComponentEvent event) {
            setFrameBounds(event.getComponent().getBounds());
          }
        });

    if (isDialog) {
      (((JDialog) frame).getContentPane()).add(this);
    } else {
      (((JFrame) frame).getContentPane()).add(this);
      menubar = loadMenuBar();
      if (menubar != null) {
        ((JFrame) frame).setJMenuBar(menubar);
      }
    }

    // TODO multimonitor supported?
    Rectangle screenSize =
        GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();

    // Use the previous dimension of this view
    Rectangle windowBounds = getFrameBounds();

    // resize window if necessary
    if (windowBounds.width > screenSize.width) windowBounds.width = screenSize.width - 50;
    if (windowBounds.height > screenSize.height) windowBounds.height = windowBounds.height - 50;

    // center window if necessary
    if (isNewDialog) {
      // frame.pack();
      frame.setSize(windowBounds.getSize());
      frame.setLocationRelativeTo(app.getMainComponent());
      isNewDialog = false;
    } else if (windowBounds.x + windowBounds.width > screenSize.width
        || windowBounds.y + windowBounds.height > screenSize.height) {
      frame.setLocationRelativeTo(null);

    } else {
      frame.setLocation(windowBounds.getLocation());
    }
    setOpenInFrame(true);

    frame.setSize(windowBounds.getSize());
    frame.setVisible(true);

    // make titlebar visible if necessary
    updatePanel();

    frame.repaint();
  }
Esempio n. 12
0
  public static void doScreenshots(File shotdir) throws Exception {
    shotdir.mkdirs();
    String prefix = "jgridstart-screenshot-";
    // setup temporary environment
    logger.info("Setting up jGridstart interactive screenshot and testing environment");
    File tmphome = FileUtils.createTempDir("jgridstart-home");
    Window mainwnd = null;
    try {
      System.setProperty("jgridstart.ca.provider", "LocalCA");
      System.setProperty("jgridstart.ca.local.hold", "true");
      System.setProperty("user.home", tmphome.getCanonicalPath());
      // create standard gui
      nl.nikhef.jgridstart.gui.Main.main(new String[] {});
      LogHelper.setupLogging(true);
      // move mouse here since closing window may give up focus later
      Thread.sleep(2000);
      guiSleep();
      mainwnd = AWT.getActiveWindow();
      assertNotNull(mainwnd);
      tester.mouseMove(mainwnd.getComponents()[0]);
      assertWindowname("jgridstart-main-window");

      /*
       * Request new
       */
      logger.info("Interactive testing scenario: Request New");
      // start screen
      saveScreenshot(new File(shotdir, prefix + "newrequest01.png"));
      // new request wizard
      guiSleep();
      tester.key(new Integer('N'), InputEvent.CTRL_MASK);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest02.png"));
      // enter details
      guiSleep();
      assertWindowname("jgridstart-requestwizard-0");
      focusByName("givenname");
      keyString("John\t");
      keyString("Doe\t");
      keyString("[email protected]\t");
      keyString("N\t");
      keyString(password + "\t");
      keyString(password + "\t");
      // wait for submission
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest03.png"));
      assertWindowname("jgridstart-requestwizard-1");
      waitEnabled(JButton.class, "Next");
      // verification form
      System.setProperty("wizard.show.help1", "true"); // simulate help btn1 pressed
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      guiSleep();
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest04.png"));
      assertWindowname("jgridstart-requestwizard-2");
      // form display
      JButton btn =
          (JButton)
              new BasicFinder()
                  .find(
                      new Matcher() {
                        public boolean matches(Component c) {
                          return c instanceof JButton
                              && ((JButton) c).getText().startsWith("display form");
                        }
                      });
      btn.doClick();
      waitEnabled(JButton.class, "Close");
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest05.png"));
      assertWindowname("jgridstart-verification-form");
      tester.key(new Integer('C'), InputEvent.ALT_MASK);
      // close wizard
      guiSleep();
      assertWindowname("jgridstart-requestwizard-2");
      tester.key(new Integer('C'), InputEvent.ALT_MASK);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest06.png"));
      assertWindowname("jgridstart-main-window");
      // enable certificate in LocalCA and refresh pane
      System.setProperty("jgridstart.ca.local.hold", "false");
      tester.key(KeyEvent.VK_F5);
      Thread.sleep(1000);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest07.png"));
      assertWindowname("jgridstart-main-window");
      // show request wizard again
      tester.key(new Integer('A'), InputEvent.ALT_MASK);
      tester.key('R');
      guiSleep();
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest08.png"));
      assertWindowname("jgridstart-requestwizard-2");
      // install step
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      Thread.sleep(1000);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest09.png"));
      assertWindowname("jgridstart-requestwizard-3");
      // show final screen
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest10.png"));
      assertWindowname("jgridstart-requestwizard-4");
      // exit wizard
      tester.key(new Integer('C'), InputEvent.ALT_MASK);
      // save final screenshot
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "newrequest11.png"));
      assertWindowname("jgridstart-main-window");
      guiSleep();

      /*
       * Renewal
       */
      logger.info("Interactive testing scenario: Renewal");
      System.setProperty("jgridstart.ca.local.hold", "true");
      // forget password so we certainly get the password dialog
      PasswordCache.getInstance().clear();
      // start screen
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew01.png"));
      assertWindowname("jgridstart-main-window");
      // personal details
      tester.key(new Integer('A'), InputEvent.ALT_MASK);
      tester.key('W');
      Thread.sleep(500);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew02.png"));
      assertWindowname("jgridstart-requestwizard-0");
      focusByName("email");
      keyString("\t");
      keyString(password + "\t");
      keyString(password + "\t");
      keyString(password + "\t");
      // wait for submission screen
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      // renew03.png used to be a password dialog, which was removed
      // submit page
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew04.png"));
      assertWindowname("jgridstart-requestwizard-1");
      waitEnabled(JButton.class, "Next");
      // wait for approval page
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew05.png"));
      assertWindowname("jgridstart-requestwizard-2");
      // close wizard
      guiSleep();
      tester.key(new Integer('C'), InputEvent.ALT_MASK);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew06.png"));
      assertWindowname("jgridstart-main-window");
      // enable certificate in LocalCA and refresh pane
      System.setProperty("jgridstart.ca.local.hold", "false");
      tester.key(KeyEvent.VK_F5);
      Thread.sleep(1000);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew07.png"));
      assertWindowname("jgridstart-main-window");
      // show request wizard again
      tester.key(new Integer('A'), InputEvent.ALT_MASK);
      tester.key('R');
      waitEnabled(JButton.class, "Next");
      Thread.sleep(500);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew08.png"));
      assertWindowname("jgridstart-requestwizard-2");
      // install step
      tester.key(new Integer('N'), InputEvent.ALT_MASK);
      Thread.sleep(1000);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew09.png"));
      assertWindowname("jgridstart-requestwizard-3");
      // exit wizard
      tester.key(new Integer('C'), InputEvent.ALT_MASK);
      // save final screenshot
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "renew10.png"));
      assertWindowname("jgridstart-main-window");
      guiSleep();

      /*
       * Import/export
       */
      logger.info("Interactive testing scenario: Import/Export");
      // forget password so we certainly get the password dialog
      PasswordCache.getInstance().clear();
      // starting screenshot (multiple certificates)
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "importexport01.png"));
      assertWindowname("jgridstart-main-window");
      // export dialog
      tester.key(new Integer('E'), InputEvent.CTRL_MASK);
      waitEnabled(JButton.class, "Export");
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "importexport02.png"));
      assertWindowname("jgridstart-export-file-dialog");
      // enter name and do export
      tester.keyString("jgridstart_test_certificate.p12\n");
      Thread.sleep(2000);
      saveScreenshot(new File(shotdir, prefix + "importexport03.png"));
      assertWindowname("jgridstart-password-entry-decrypt");
      tester.keyString(password + "\n");
      guiSleep();
      assertWindowname("jgridstart-main-window");

      // forget password so we certainly get the password dialog
      PasswordCache.getInstance().clear();

      // import dialog
      tester.key(new Integer('I'), InputEvent.CTRL_MASK);
      waitEnabled(JButton.class, "Import");
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "importexport04.png"));
      assertWindowname("jgridstart-import-file-dialog");
      guiSleep();
      // enter name and do import
      tester.keyString("jgridstart_test_certificate.p12\n");
      Thread.sleep(1000);
      saveScreenshot(new File(shotdir, prefix + "importexport05.png"));
      assertWindowname("jgridstart-password-entry-decrypt");
      keyString(password + "\n");
      guiSleep();

      /*
       * Certificate details
       */
      logger.info("Interactive testing scenario: Certificate details");
      // certificate details view
      mainwnd.setSize(750, 480);
      System.setProperty("view.showdetails", "true");
      URLLauncherCertificate.performAction("viewlist(false)", mainwnd);
      tester.key(KeyEvent.VK_F5);
      Thread.sleep(500);
      guiSleep();
      saveScreenshot(new File(shotdir, prefix + "viewdetails01.png"));
      assertWindowname("jgridstart-main-window");

      /*
       * Exit!
       */
      logger.info("Interactive testing finished");
      /* Quit does a {@link System.exit}, which JUnit doesn't like. The
       * error it gives is something like:
       *   [junit] Test <testclass> FAILED (crashed)
       * So we leave it to the calling function to dispose of the window.
       */
      // tester.key(new Integer('Q'), InputEvent.CTRL_MASK);

    } finally {
      guiSleep();
      Thread.sleep(500); // for screenshot to complete ...
      FileUtils.recursiveDelete(tmphome);
    }
    // exit!
    return;
  }
Esempio n. 13
0
  /**
   * This method is used at the end of a drag session to place the frame in either its original
   * parent as a docked JToolBar or in its floating frame.
   *
   * @param position The position of the mouse cursor relative to the JToolBar.
   * @param origin The screen position of the JToolBar before the drag session started.
   */
  protected void floatAt(Point position, Point origin) {
    Point p = new Point(position);
    int aoc = areaOfClick(origParent, SwingUtilities.convertPoint(toolBar, p, origParent));

    Container oldParent = toolBar.getParent();

    oldParent.remove(toolBar);
    oldParent.doLayout();
    oldParent.repaint();

    Container newParent;

    if (aoc == -1) newParent = ((RootPaneContainer) floatFrame).getContentPane();
    else {
      floatFrame.hide();
      newParent = origParent;
    }

    String constraint;
    switch (aoc) {
      case SwingConstants.EAST:
        constraint = BorderLayout.EAST;
        break;
      case SwingConstants.NORTH:
        constraint = BorderLayout.NORTH;
        break;
      case SwingConstants.SOUTH:
        constraint = BorderLayout.SOUTH;
        break;
      case SwingConstants.WEST:
        constraint = BorderLayout.WEST;
        break;
      default:
        constraint = BorderLayout.CENTER;
        break;
    }

    int newOrientation = SwingConstants.HORIZONTAL;
    if ((aoc != -1) && ((aoc == SwingConstants.EAST) || (aoc == SwingConstants.WEST)))
      newOrientation = SwingConstants.VERTICAL;

    if (aoc != -1) {
      constraintBeforeFloating = constraint;
      lastGoodOrientation = newOrientation;
    }

    newParent.add(toolBar, constraint);

    setFloating(aoc == -1, null);
    toolBar.setOrientation(newOrientation);

    Insets insets = floatFrame.getInsets();
    Dimension dims = toolBar.getPreferredSize();
    p = dragWindow.getOffset();
    setFloatingLocation(
        (position.x + origin.x) - p.x - ((insets.left + insets.right) / 2),
        (position.y + origin.y) - p.y - ((insets.top + insets.bottom) / 2));

    if (aoc == -1) {
      floatFrame.pack();
      floatFrame.setSize(
          dims.width + insets.left + insets.right, dims.height + insets.top + insets.bottom);
      floatFrame.show();
    }

    newParent.invalidate();
    newParent.validate();
    newParent.repaint();
  }
 /**
  * Resizes this stub's viewer when the {@code Applet} wants to be resized.
  *
  * @param width the new requested width for the {@code Applet}.
  * @param height the new requested height for the {@code Applet}.
  */
 @Override
 public void appletResize(int width, int height) {
   viewer.setSize(width, height);
 }