public void mousePressed(MouseEvent e) {
      if (e.getButton() == e.BUTTON3) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(2);
        int index = list.locationToIndex(e.getPoint());
        GetImageFile gif = new GetImageFile(files[index]);

        JTextArea area =
            new JTextArea(
                "File: "
                    + gif.getImageString()
                    + "\n"
                    + "Score: "
                    + nf.format(scores[index])
                    + "\n"
                    + "Pairs: "
                    + nrpairs[index]);
        area.setEditable(false);
        area.setBorder(BorderFactory.createLineBorder(Color.black));
        area.setFont(new Font("times", Font.PLAIN, 12));
        PopupFactory factory = PopupFactory.getSharedInstance();
        popup =
            factory.getPopup(
                null,
                area,
                (int) e.getComponent().getLocationOnScreen().getX() + e.getX() + 25,
                (int) e.getComponent().getLocationOnScreen().getY() + e.getY());
        popup.show();
      }
    }
  /**
   * Returns a <code>Popup</code> instance from the <code>PopupMenuUI</code> that has had <code>show
   * </code> invoked on it. If the current <code>popup</code> is non-null, this will invoke <code>
   * dispose</code> of it, and then <code>show</code> the new one.
   *
   * <p>This does NOT fire any events, it is up the caller to dispatch the necessary events.
   */
  private Popup getPopup() {
    Popup oldPopup = popup;

    if (oldPopup != null) {
      oldPopup.hide();
    }
    PopupFactory popupFactory = PopupFactory.getSharedInstance();

    if (isLightWeightPopupEnabled()) {
      popupFactory.setPopupType(PopupFactory.LIGHT_WEIGHT_POPUP);
    } else {
      popupFactory.setPopupType(PopupFactory.MEDIUM_WEIGHT_POPUP);
    }

    // adjust the location of the popup
    Point p = adjustPopupLocationToFitScreen(desiredLocationX, desiredLocationY);
    desiredLocationX = p.x;
    desiredLocationY = p.y;

    Popup newPopup = getUI().getPopup(this, desiredLocationX, desiredLocationY);

    popupFactory.setPopupType(PopupFactory.LIGHT_WEIGHT_POPUP);
    newPopup.show();
    return newPopup;
  }