Java 类javax.swing.Popup 实例源码

项目:incubator-netbeans    文件:CustomPopupFactory.java   
@Override
public Popup getPopup(Component owner, Component contents,
                      int x, int y) throws IllegalArgumentException {
    assert owner instanceof JComponent;
    Dimension d = contents.getPreferredSize();
    Container c = ((JComponent) owner).getTopLevelAncestor();
    if (c == null) {
        throw new IllegalArgumentException ("Not onscreen: " + owner);
    }
    Point p = new Point (x, y);
    SwingUtilities.convertPointFromScreen(p, c);
    Rectangle r = new Rectangle (p.x, p.y, d.width, d.height);
    if (c.getBounds().contains(r)) {
        //XXX need API to determine if editor area comp is heavyweight,
        //and if so, return a "medium weight" popup of a java.awt.Component
        //that embeds the passed contents component
        return new LWPopup (owner, contents, x, y);
    } else {
        return new HWPopup (owner, contents, x, y);
    }
}
项目:rapidminer    文件:RoundedRectanglePopup.java   
private void initPopup(Component owner, Component contents, int x, int y, Popup popup) {
    this.owner = owner;
    this.contents = contents;
    this.popup = popup;
    this.x = x;
    this.y = y;

    boolean mac = false;
    try {
        mac = System.getProperty("os.name").toLowerCase().startsWith("mac");
    } catch (SecurityException e) {
        // do nothing
    }
    if (mac) {
        ((JComponent) contents).setBorder(Borders.getPopupMenuBorder());
    } else if (((JComponent) contents).getBorder() instanceof DummyBorder) {
        if (!((owner instanceof JMenu) && ((JMenu) owner).isTopLevelMenu())
                && !((owner.getParent() != null) && (owner.getParent() instanceof javax.swing.JToolBar))
                && !((owner != null) && (owner instanceof javax.swing.JComboBox))) {
            ((JComponent) contents).setBorder(Borders.getShadowedPopupMenuBorder());
        } else {
            ((JComponent) contents).setBorder(Borders.getPopupBorder());
        }
    }
}
项目:rapidminer    文件:PopupPanel.java   
/**
 * Checks if the focus is still on this component or its child components.
 */
private boolean isFocusInside(Object newFocusedComp) {
    if (newFocusedComp instanceof Popup) {
        return true;
    }
    if (newFocusedComp instanceof Component && !SwingUtilities.isDescendingFrom((Component) newFocusedComp, this)) {
        // Check if focus is on other window
        if (containingWindow == null) {
            return false;
        }

        Window focusedWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();

        // if focus is on other window return true
        if (containingWindow == focusedWindow) {
            return false;
        }
    }
    return true;
}
项目:Logisim    文件:LayoutPopupManager.java   
private void showPopup(Set<AppearancePort> portObjects) {
    dragStart = null;
    CircuitState circuitState = canvas.getCircuitState();
    if (circuitState == null)
        return;
    ArrayList<Instance> ports = new ArrayList<Instance>(portObjects.size());
    for (AppearancePort portObject : portObjects) {
        ports.add(portObject.getPin());
    }

    hideCurrentPopup();
    LayoutThumbnail layout = new LayoutThumbnail();
    layout.setCircuit(circuitState, ports);
    JViewport owner = canvasPane.getViewport();
    Point ownerLoc = owner.getLocationOnScreen();
    Dimension ownerDim = owner.getSize();
    Dimension layoutDim = layout.getPreferredSize();
    int x = ownerLoc.x + Math.max(0, ownerDim.width - layoutDim.width - 5);
    int y = ownerLoc.y + Math.max(0, ownerDim.height - layoutDim.height - 5);
    PopupFactory factory = PopupFactory.getSharedInstance();
    Popup popup = factory.getPopup(canvasPane.getViewport(), layout, x, y);
    popup.show();
    curPopup = popup;
    curPopupTime = System.currentTimeMillis();
}
项目:pumpernickel    文件:AppletPopupFactory.java   
@Override
public Popup getPopup(Component owner, Component contents, int x, int y)
        throws IllegalArgumentException {
    Component[] hierarchy = getHierarchy(owner);
    for(int a = hierarchy.length-1; a>=0; a--) {
        if(hierarchy[a] instanceof JApplet && 
                contents instanceof JComponent) {
            return new AppletPopup( (JApplet)hierarchy[a], owner, (JComponent)contents, x, y);

        /* Unfortunately we can't simply check against a java.awt.Frame,
         * because applets can be embedded in a 
         * sun.plugin2.main.client.PluginEmbeddedFrame.
         */
        //} else if(hierarchy[a] instanceof Frame) {
        } else if(hierarchy[a] instanceof JFrame) {
            return oldFactory.getPopup(owner, contents, x, y);
        }
    }
    return oldFactory.getPopup(owner, contents, x, y);
}
项目:rapidminer-studio    文件:RoundedRectanglePopup.java   
private void initPopup(Component owner, Component contents, int x, int y, Popup popup) {
    this.owner = owner;
    this.contents = contents;
    this.popup = popup;
    this.x = x;
    this.y = y;

    boolean mac = false;
    try {
        mac = System.getProperty("os.name").toLowerCase().startsWith("mac");
    } catch (SecurityException e) {
        // do nothing
    }
    if (mac) {
        ((JComponent) contents).setBorder(Borders.getPopupMenuBorder());
    } else if (((JComponent) contents).getBorder() instanceof DummyBorder) {
        if ((owner != null) //
                && (((owner instanceof JMenu) && ((JMenu) owner).isTopLevelMenu()) //
                || ((owner.getParent() != null) && (owner.getParent() instanceof javax.swing.JToolBar)) //
                || (owner instanceof javax.swing.JComboBox))) {
            ((JComponent) contents).setBorder(Borders.getPopupBorder());
        } else {
            ((JComponent) contents).setBorder(Borders.getShadowedPopupMenuBorder());
        }
    }
}
项目:rapidminer-studio    文件:PopupPanel.java   
/**
 * Checks if the focus is still on this component or its child components.
 */
private boolean isFocusInside(Object newFocusedComp) {
    if (newFocusedComp instanceof Popup) {
        return true;
    }
    if (newFocusedComp instanceof Component && !SwingUtilities.isDescendingFrom((Component) newFocusedComp, this)) {
        // Check if focus is on other window
        if (containingWindow == null) {
            return false;
        }

        Window focusedWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();

        // if focus is on other window return true
        if (containingWindow == focusedWindow) {
            return false;
        }
    }
    return true;
}
项目:sqlpower-library    文件:PopupListenerHandler.java   
/**
* Creates a new {@link PopupListenerHandler} for the given {@link Popup},
* glass pane and owning frame associated with the {@link Popup}. A
* {@link ComponentListener} and {@link MouseAdapter} is also created to be
* attached to the glass pane and owning frame to determine when to cleanup
* the {@link Popup}.
* 
* @param popup
*            The {@link Popup} this class handles.
* @param glassPane
*            The {@link JComponent} that mouse clicks should be listened
*            for to figure out when to close the {@link Popup}.
* @param owningFrame
*            The {@link Component} that the {@link Popup} belongs to.
*/
  public PopupListenerHandler(final Popup popup, final JComponent glassPane, final Component owningFrame) {
      this.popup = popup;
      this.glassPane = glassPane;
      this.owningFrame = owningFrame;

      clickListener = new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent e) {
              super.mouseReleased(e);
              cleanup();
          }
      };

      resizeListener = new ComponentAdapter() {
          public void componentMoved(ComponentEvent e) {
              cleanup();
          }
      };

  }
项目:WorldGrower    文件:CustomPopupFactory.java   
public static void setPopupFactory() {
    PopupFactory.setSharedInstance(new PopupFactory() {

        @Override
        public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException {
            if (contents instanceof JToolTip) {
                JToolTip toolTip = (JToolTip)contents;
                int width = (int) toolTip.getPreferredSize().getWidth();

                GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
                int screenWidth = gd.getDisplayMode().getWidth();

                // if there is enough room, move tooltip to the right to have enough room
                // for large tooltips.
                // this way they don't hinder mouse movement and make it possible to easily
                // view multiple tooltips of items.
                if (x + width + TOOLTIP_X_OFFSET < screenWidth) {
                    x += TOOLTIP_X_OFFSET;
                }
            }
            return super.getPopup(owner, contents, x, y);
        }
    });
}
项目:javamelody    文件:ShadowPopupFactory.java   
static Popup getInstance(Component owner, Component contents, int x, int y,
        Popup delegate) {
    final ShadowPopup result;
    synchronized (ShadowPopup.class) {
        if (cache == null) {
            cache = new ArrayList<>(MAX_CACHE_SIZE);
        }
        if (!cache.isEmpty()) {
            result = cache.remove(0);
        } else {
            result = new ShadowPopup();
        }
    }
    result.reset(owner, contents, x, y, delegate);
    return result;
}
项目:ireport-fork    文件:ApplePopupFactory.java   
public Popup getPopup(Component owner, Component contents,
                      int x, int y) throws IllegalArgumentException {
    assert owner instanceof JComponent;
    Dimension d = contents.getPreferredSize();
    Container c = ((JComponent) owner).getTopLevelAncestor();
    if (c == null) {
        throw new IllegalArgumentException ("Not onscreen: " + owner);
    }
    Point p = new Point (x, y);
    SwingUtilities.convertPointFromScreen(p, c);
    Rectangle r = new Rectangle (p.x, p.y, d.width, d.height);
    if (c.getBounds().contains(r)) {
        //XXX need API to determine if editor area comp is heavyweight,
        //and if so, return a "medium weight" popup of a java.awt.Component
        //that embeds the passed contents component
        return new LWPopup (owner, contents, x, y);
    } else {
        return APPLE_HEAVYWEIGHT ? 
            (Popup) new HWPopup (owner, contents, x, y) :
            (Popup) new NullPopup();
    }
}
项目:logisim-evolution    文件:LayoutPopupManager.java   
private void showPopup(Set<AppearancePort> portObjects) {
    dragStart = null;
    CircuitState circuitState = canvas.getCircuitState();
    if (circuitState == null)
        return;
    ArrayList<Instance> ports = new ArrayList<Instance>(portObjects.size());
    for (AppearancePort portObject : portObjects) {
        ports.add(portObject.getPin());
    }

    hideCurrentPopup();
    LayoutThumbnail layout = new LayoutThumbnail();
    layout.setCircuit(circuitState, ports);
    JViewport owner = canvasPane.getViewport();
    Point ownerLoc = owner.getLocationOnScreen();
    Dimension ownerDim = owner.getSize();
    Dimension layoutDim = layout.getPreferredSize();
    int x = ownerLoc.x + Math.max(0, ownerDim.width - layoutDim.width - 5);
    int y = ownerLoc.y
            + Math.max(0, ownerDim.height - layoutDim.height - 5);
    PopupFactory factory = PopupFactory.getSharedInstance();
    Popup popup = factory.getPopup(canvasPane.getViewport(), layout, x, y);
    popup.show();
    curPopup = popup;
    curPopupTime = System.currentTimeMillis();
}
项目:ProyectoLogisim    文件:LayoutPopupManager.java   
private void showPopup(Set<AppearancePort> portObjects) {
    dragStart = null;
    CircuitState circuitState = canvas.getCircuitState();
    if (circuitState == null) return;
    ArrayList<Instance> ports = new ArrayList<Instance>(portObjects.size());
    for (AppearancePort portObject : portObjects) {
        ports.add(portObject.getPin());
    }

    hideCurrentPopup();
    LayoutThumbnail layout = new LayoutThumbnail();
    layout.setCircuit(circuitState, ports);
    JViewport owner = canvasPane.getViewport();
    Point ownerLoc = owner.getLocationOnScreen();
    Dimension ownerDim = owner.getSize();
    Dimension layoutDim = layout.getPreferredSize();
    int x = ownerLoc.x + Math.max(0, ownerDim.width - layoutDim.width - 5);
    int y = ownerLoc.y + Math.max(0, ownerDim.height - layoutDim.height - 5);
    PopupFactory factory = PopupFactory.getSharedInstance();
    Popup popup = factory.getPopup(canvasPane.getViewport(), layout, x, y);
    popup.show();
    curPopup = popup;
    curPopupTime = System.currentTimeMillis();
}
项目:rapidminer-5    文件:RoundedRectanglePopup.java   
private void initPopup(Component owner, Component contents, int x, int y, Popup popup) {
    this.owner = owner;
    this.contents = contents;
    this.popup = popup;
    this.x = x;
    this.y = y;

    boolean mac = false;
    try {
        mac = System.getProperty("os.name").toLowerCase().startsWith("mac");
    } catch (SecurityException e) {
        // do nothing
    }
    if (mac) {
        ((JComponent) contents).setBorder(Borders.getPopupMenuBorder());
    } else if (((JComponent) contents).getBorder() instanceof DummyBorder) {
        if (!((owner instanceof JMenu) && ((JMenu) owner).isTopLevelMenu()) && !((owner.getParent() != null) && (owner.getParent() instanceof javax.swing.JToolBar)) && !((owner != null) && (owner instanceof javax.swing.JComboBox))) {
            ((JComponent) contents).setBorder(Borders.getShadowedPopupMenuBorder());
        } else {
            ((JComponent) contents).setBorder(Borders.getPopupBorder());
        }
    }
}
项目:rapidminer-5    文件:PopupPanel.java   
/**
 * Checks if the focus is still on this component or its child components.
 */
private boolean isFocusInside(Object newFocusedComp) {
    if(newFocusedComp instanceof Popup) {
        return true;
    }
    if (newFocusedComp instanceof Component && !SwingUtilities.isDescendingFrom((Component)newFocusedComp, this)) {
        //Check if focus is on other window
        if (containingWindow == null) {
            return false;
        }

        Window focusedWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();

        // if focus is on other window return true
        if (containingWindow == focusedWindow) {
            return false;
        }
    }
    return true;
}
项目:incubator-netbeans    文件:VisualDesignerPopupMenuUI.java   
@Override
public Popup getPopup(JPopupMenu popup, int x, int y) {
    PopupFactory popupFactory = layer.hackedPopupFactory;
    if(popupFactory == null) {
        return super.getPopup(popup, x, y);
    }
    return popupFactory.getPopup(popup.getInvoker(), popup, x, y);
}
项目:incubator-netbeans    文件:VisualDesignerPopupFactory.java   
@Override
public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException {
    final JMenu menu = (JMenu) owner;
    JPanel cont = containerMap.get(menu);

    if (cont == null) {
        cont = new VisualDesignerJPanelContainer(menu,this);
        cont.setLayout(new BoxLayout(cont, BoxLayout.Y_AXIS));

        RADVisualContainer menuRAD = (RADVisualContainer) canvas.formDesigner.getMetaComponent(menu);
        for(RADComponent c : menuRAD.getSubBeans()) {
            JComponent comp = (JComponent) canvas.formDesigner.getComponent(c);
            cont.add(comp);
        }

        cont.setBorder(BorderFactory.createLineBorder(Color.BLACK));
        containerMap.put(menu,cont);
        canvas.layers.add(cont, JLayeredPane.DEFAULT_LAYER);
    }

    cont.setSize(cont.getLayout().preferredLayoutSize(cont));
    canvas.validate();
    canvas.setVisible(true);
    final JPanel fcont = cont;
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            setLocationFromMenu(menu, fcont);
        }
    });

    canvas.validate();
    canvas.repaint();
    VisualDesignerJPanelPopup popup = new VisualDesignerJPanelPopup(cont, menu, this);
    popupMap.put(menu,popup);
    return popup;
}
项目:incubator-netbeans    文件:InnerPanelSupport.java   
@Override
public void mouseMoved(MouseEvent e) {
    Point p = e.getPoint();
    int col = listClasses.columnAtPoint(p);
    int row = listClasses.rowAtPoint(p);

    if (col < 0 || row < 0) {
        hidePopup();
        return;
    }
    if (col == currentCol && row == currentRow) {
        // the tooltip is (probably) shown, do not create again
        return;
    }
    Rectangle cellRect = listClasses.getCellRect(row, col, false);
    Point pt = cellRect.getLocation();
    SwingUtilities.convertPointToScreen(pt, listClasses);

    RenderedImage ri = new RenderedImage();
    if (!updateTooltipImage(ri, row, col)) {
        return;
    }
    ri.addMouseListener(this);

    Popup popup = PopupFactory.getSharedInstance().getPopup(listClasses, ri, pt.x, pt.y);
    popupContents = ri;
    currentPopup = popup;
    currentCol = col;
    currentRow = row;
    popup.show();
    System.err.println("Hello");
}
项目:rapidminer    文件:RoundedRectanglePopup.java   
static Popup getInstance(Component owner, Component contents, int x, int y, Popup delegate) {
    RoundedRectanglePopup popup;

    synchronized (RoundedRectanglePopup.class) {
        popup = new RoundedRectanglePopup();
    }

    popup.initPopup(owner, contents, x, y, delegate);
    return popup;
}
项目:gate-core    文件:LuceneDataStoreSearchGUI.java   
private void addStatistics(String kind, int count, int numRow,
        final MouseEvent e) {
  JLabel label = (JLabel)e.getComponent();
  if(!label.getToolTipText().contains(kind)) {
    // add the statistics to the tooltip
    String toolTip = label.getToolTipText();
    toolTip = toolTip.replaceAll("</?html>", "");
    toolTip = kind + " = " + count + "<br>" + toolTip;
    toolTip = "<html>" + toolTip + "</html>";
    label.setToolTipText(toolTip);
  }
  if(bottomSplitPane.getDividerLocation()
          / bottomSplitPane.getSize().getWidth() < 0.90) {
    // select the row in the statistics table
    statisticsTabbedPane.setSelectedIndex(1);
    oneRowStatisticsTable.setRowSelectionInterval(numRow, numRow);
    oneRowStatisticsTable.scrollRectToVisible(oneRowStatisticsTable
            .getCellRect(numRow, 0, true));
  } else {
    // display a tooltip
    JToolTip tip = label.createToolTip();
    tip.setTipText(kind + " = " + count);
    PopupFactory popupFactory = PopupFactory.getSharedInstance();
    final Popup tipWindow =
            popupFactory.getPopup(label, tip, e.getX()
                    + e.getComponent().getLocationOnScreen().x, e.getY()
                    + e.getComponent().getLocationOnScreen().y);
    tipWindow.show();
    Date timeToRun = new Date(System.currentTimeMillis() + 2000);
    Timer timer = new Timer("Annic statistics hide tooltip timer", true);
    timer.schedule(new TimerTask() {
      @Override
      public void run() {
        // hide the tooltip after 2 seconds
        tipWindow.hide();
      }
    }, timeToRun);
  }
}
项目:gate-core    文件:LuceneDataStoreSearchGUI.java   
private void addStatistics(String kind, int count, int numRow,
        final MouseEvent e) {
  JLabel label = (JLabel)e.getComponent();
  if(!label.getToolTipText().contains(kind)) {
    // add the statistics to the tooltip
    String toolTip = label.getToolTipText();
    toolTip = toolTip.replaceAll("</?html>", "");
    toolTip = kind + " = " + count + "<br>" + toolTip;
    toolTip = "<html>" + toolTip + "</html>";
    label.setToolTipText(toolTip);
  }
  if(bottomSplitPane.getDividerLocation()
          / bottomSplitPane.getSize().getWidth() < 0.90) {
    // select the row in the statistics table
    statisticsTabbedPane.setSelectedIndex(1);
    oneRowStatisticsTable.setRowSelectionInterval(numRow, numRow);
    oneRowStatisticsTable.scrollRectToVisible(oneRowStatisticsTable
            .getCellRect(numRow, 0, true));
  } else {
    // display a tooltip
    JToolTip tip = label.createToolTip();
    tip.setTipText(kind + " = " + count);
    PopupFactory popupFactory = PopupFactory.getSharedInstance();
    final Popup tipWindow =
            popupFactory.getPopup(label, tip, e.getX()
                    + e.getComponent().getLocationOnScreen().x, e.getY()
                    + e.getComponent().getLocationOnScreen().y);
    tipWindow.show();
    Date timeToRun = new Date(System.currentTimeMillis() + 2000);
    Timer timer = new Timer("Annic statistics hide tooltip timer", true);
    timer.schedule(new TimerTask() {
      @Override
      public void run() {
        // hide the tooltip after 2 seconds
        tipWindow.hide();
      }
    }, timeToRun);
  }
}
项目:OpenJSharp    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:jdk8u-jdk    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:openjdk-jdk10    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:openjdk-jdk10    文件:PopupMenuTest.java   
private void dispose() throws Exception {
    SwingUtilities.invokeAndWait(() -> {
        Popup popup = PopMenuUIExt.getPopup();
        if (popup != null) {
            popup.hide();
        }
        frame.dispose();
    });
}
项目:openjdk-jdk10    文件:PopupMenuTest.java   
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
    Popup popup = ((PopMenuUIExt) jpopup.getUI()).getPopup();
    if (popup != null) {
        isLightWeight = !popup.getClass().toString().
                contains("HeavyWeightPopup");
    }
}
项目:Logisim    文件:LayoutPopupManager.java   
public void hideCurrentPopup() {
    Popup cur = curPopup;
    if (cur != null) {
        curPopup = null;
        dragStart = null;
        cur.hide();
    }
}
项目:openjdk9    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:Java8CN    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:jdk8u_jdk    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:jdk8u_jdk    文件:Popup401.java   
private void run() {
    JPanel panel = new JPanel();

    int count = 0;
    long diffTime, initialDiffTime = 0;
    while (count < ITERATION_NUMBER) {
        robot.delay(ROBOT_DELAY);

        PopupFactory factory = PopupFactory.getSharedInstance();
        Popup popup = factory.getPopup(panel, textArea, editorPane.getLocation().x + 20,
                editorPane.getLocation().y + 20);

        long startTime = System.currentTimeMillis();
        popup.show();
        long endTime = System.currentTimeMillis();
        diffTime = endTime - startTime;

        if (count > 1) {
            if (diffTime * HANG_TIME_FACTOR < (endTime - startTime)) {
                throw new RuntimeException("The test is near to be hang: iteration count = " + count
                        + " initial time = " + initialDiffTime
                        + " current time = " + diffTime);
            }
        } else {
            initialDiffTime = diffTime;
        }
        count++;
        robot.delay(ROBOT_DELAY);

        popup.hide();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:rapidminer-studio    文件:RoundedRectanglePopup.java   
static Popup getInstance(Component owner, Component contents, int x, int y, Popup delegate) {
    RoundedRectanglePopup popup;

    synchronized (RoundedRectanglePopup.class) {
        popup = new RoundedRectanglePopup();
    }

    popup.initPopup(owner, contents, x, y, delegate);
    return popup;
}
项目:beautyeye    文件:TranslucentPopupFactory.java   
@Override
public Popup getPopup(Component owner, Component contents, int x, int y)
        throws IllegalArgumentException
{
    // A more complete implementation would cache and reuse popups
    return new TranslucentPopup(owner, contents, x, y);
}
项目:confluence.keygen    文件:ShadowPopup.java   
private void reset(Component owner, Component contents, int x, int y, Popup popup)
/* 111:    */   {
/* 112:208 */     this.owner = owner;
/* 113:209 */     this.contents = contents;
/* 114:210 */     this.popup = popup;
/* 115:211 */     this.x = x;
/* 116:212 */     this.y = y;
/* 117:213 */     if ((owner instanceof JComboBox)) {
/* 118:214 */       return;
/* 119:    */     }
/* 120:219 */     Dimension contentsPrefSize = contents.getPreferredSize();
/* 121:220 */     if ((contentsPrefSize.width <= 0) || (contentsPrefSize.height <= 0)) {
/* 122:221 */       return;
/* 123:    */     }
/* 124:223 */     for (Container p = contents.getParent(); p != null; p = p.getParent()) {
/* 125:224 */       if (((p instanceof JWindow)) || ((p instanceof Panel)))
/* 126:    */       {
/* 127:226 */         p.setBackground(contents.getBackground());
/* 128:227 */         this.heavyWeightContainer = p;
/* 129:228 */         break;
/* 130:    */       }
/* 131:    */     }
/* 132:231 */     JComponent parent = (JComponent)contents.getParent();
/* 133:232 */     this.oldOpaque = parent.isOpaque();
/* 134:233 */     this.oldBorder = parent.getBorder();
/* 135:234 */     parent.setOpaque(false);
/* 136:235 */     parent.setBorder(SHADOW_BORDER);
/* 137:237 */     if (this.heavyWeightContainer != null) {
/* 138:238 */       this.heavyWeightContainer.setSize(this.heavyWeightContainer.getPreferredSize());
/* 139:    */     } else {
/* 140:241 */       parent.setSize(parent.getPreferredSize());
/* 141:    */     }
/* 142:    */   }
项目:stendhal    文件:StyledPopupMenuUI.java   
@Override
public Popup getPopup(JPopupMenu menu, int x, int y) {
    Popup popup = super.getPopup(menu, x, y);
    /*
     * The menu should now have a parent, which is probably a JPanel, In
     * which case its borders need to be deleted.
     */
    Container parent = menu.getParent();
    if (parent instanceof JComponent) {
        ((JComponent) parent).setBorder(null);
    }

    return popup;
}
项目:Swing9patch    文件:CoolPopupFactory.java   
@Override
public Popup getPopup(Component owner, Component contents, int x, int y)
        throws IllegalArgumentException
{
    // A more complete implementation would cache and reuse popups
    return new TranslucentPopup(owner, contents, x, y);
}
项目:javamelody    文件:ShadowPopupFactory.java   
/**
 * Reinitializes this ShadowPopup using the given parameters.
 *
 * @param newOwner component mouse coordinates are relative to, may be null
 * @param newContents the contents of the popup
 * @param newX the desired x location of the popup
 * @param newY the desired y location of the popup
 * @param newPopup the popup to wrap
 */
private void reset(Component newOwner, Component newContents, int newX, int newY,
        Popup newPopup) {
    this.owner = newOwner;
    this.contents = newContents;
    this.popup = newPopup;
    this.x = newX;
    this.y = newY;
    if (newOwner instanceof JComboBox) {
        return;
    }
    // Do not install the shadow border when the contents
    // has a preferred size less than or equal to 0.
    // We can't use the size, because it is(0, 0) for new popups.
    final Dimension contentsPrefSize = newContents.getPreferredSize();
    if (contentsPrefSize.width <= 0 || contentsPrefSize.height <= 0) {
        return;
    }
    for (Container p = newContents.getParent(); p != null; p = p.getParent()) {
        if (p instanceof JWindow || p instanceof Panel) {
            // Workaround for the gray rect problem.
            p.setBackground(newContents.getBackground());
            heavyWeightContainer = p;
            break;
        }
    }
    final JComponent parent = (JComponent) newContents.getParent();
    oldOpaque = parent.isOpaque();
    oldBorder = parent.getBorder();
    parent.setOpaque(false);
    parent.setBorder(SHADOW_BORDER);
    // Pack it because we have changed the border.
    if (heavyWeightContainer != null) {
        heavyWeightContainer.setSize(heavyWeightContainer.getPreferredSize());
    } else {
        parent.setSize(parent.getPreferredSize());
    }
}
项目:infobip-open-jdk-8    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}
项目:jdk8u-dev-jdk    文件:MultiPopupMenuUI.java   
/**
 * Invokes the <code>getPopup</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 * @since 1.4
 */
public Popup getPopup(JPopupMenu a, int b, int c) {
    Popup returnValue =
        ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c);
    }
    return returnValue;
}