/**
   * MouseListener implementation. Shows an internal frame with the picture of the player whose
   * label was clicked.
   */
  public void mouseClicked(MouseEvent evt) {
    Object source = evt.getSource();

    if ((source == whiteLabel) || (source == blackLabel)) {
      String name = (source == whiteLabel ? getGame().getWhiteName() : getGame().getBlackName());
      URL url;
      try {
        url = new URL("http://www.chessclub.com/mugshots/" + name + ".jpg");
      } catch (MalformedURLException e) {
        e.printStackTrace();
        return;
      }

      JInternalFrame frame = new UserImageInternalFrame(url, name);
      frame.setLocation(0, 0);
      JDesktopPane desktop = boardManager.getPluginContext().getMainFrame().getDesktop();
      desktop.add(frame, JLayeredPane.PALETTE_LAYER);
      frame.setSize(frame.getPreferredSize());
      frame.setVisible(true);
      frame.toFront();
    }
  }
  /** Adds the given componet to the given layer. */
  public void addEditorWindow(EditorWindowIndirectRef windowRef) {
    final JInternalFrame window = (JInternalFrame) windowRef;

    Dimension desktopSize = desktopPane.getSize();
    Dimension preferredSize = window.getPreferredSize();

    int x = desktopSize.width / 2 - preferredSize.width / 2;
    int y = desktopSize.height / 2 - preferredSize.height / 2;

    window.setBounds(x, y, preferredSize.width, preferredSize.height);

    // This line sometimes hangs, so I'm putting it in a watch process
    // so it can be stopped by the user. Not ideal.
    //        Window owner = (Window) getTopLevelAncestor();
    //
    //        new WatchedProcess(owner) {
    //            public void watch() {
    getDesktopPane().add(window);
    window.setLayer(100);
    window.moveToFront();

    try {
      window.setVisible(true);
    } catch (Exception e) {
      if (e instanceof ClassCastException || e instanceof NullPointerException) {
        // skip. These is being caused apparently the workbench
        // having labeled nodes and edges. Can't find a
        // workaround--probably a Java bug. jdramsey
      } else {
        e.printStackTrace();
      }
    }

    // prevents the component from being hidden.
    //                window.addComponentListener(new PositionListener());
    //            }
    //        };
  }