예제 #1
0
 public static void hidePopups(Component comp) {
   if (comp != null) {
     label0:
     for (Component c = comp; c != null; c = c.getParent()) {
       if (!(c instanceof ZPopupGallery)) continue;
       do {
         if (currShownList.size() <= 0) continue label0;
         if (currShownList.getLast() == c) return;
         ZPopupGallery jpg = (ZPopupGallery) currShownList.removeLast();
         Popup popup = (Popup) popupGalleryHM.get(jpg);
         popup.hide();
         popupGalleryHM.remove(jpg);
       } while (true);
     }
   }
   Iterator iterator = popupGalleryHM.keySet().iterator();
   do {
     if (!iterator.hasNext()) break;
     ZPopupGallery gallery = (ZPopupGallery) iterator.next();
     ((Popup) popupGalleryHM.get(gallery)).hide();
     if (gallery.getActionListener() != null)
       gallery.getActionListener().actionPerformed(new ActionEvent(gallery, 1, "Hidden"));
   } while (true);
   popupGalleryHM.clear();
 }
예제 #2
0
    private static void fixPopupSize(final Popup popup, final Component contents) {
      if (!UIUtil.isUnderGTKLookAndFeel() || !(contents instanceof JPopupMenu)) return;

      for (Class<?> aClass = popup.getClass();
          aClass != null && Popup.class.isAssignableFrom(aClass);
          aClass = aClass.getSuperclass()) {
        try {
          final Method getComponent = aClass.getDeclaredMethod("getComponent");
          getComponent.setAccessible(true);
          final Object component = getComponent.invoke(popup);
          if (component instanceof JWindow) {
            ((JWindow) component).setSize(new Dimension(0, 0));
          }
          break;
        } catch (Exception ignored) {
        }
      }
    }
예제 #3
0
 public void mouseReleased(MouseEvent e) {
   if (e.isPopupTrigger()) {
     Popup popup = new Popup();
     popup.show(e.getComponent(), e.getX(), e.getY());
   }
 }