當前位置: 首頁>>代碼示例>>Java>>正文


Java JPopupMenu.isShowing方法代碼示例

本文整理匯總了Java中javax.swing.JPopupMenu.isShowing方法的典型用法代碼示例。如果您正苦於以下問題:Java JPopupMenu.isShowing方法的具體用法?Java JPopupMenu.isShowing怎麽用?Java JPopupMenu.isShowing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JPopupMenu的用法示例。


在下文中一共展示了JPopupMenu.isShowing方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dynamicChange

import javax.swing.JPopupMenu; //導入方法依賴的package包/類
public static void dynamicChange(final JPopupMenu popup, boolean usedToBeContained) {
        if (!popup.isShowing()) {
            return;
        }

        if (isProblemConfig()) {
            callRefreshLater(popup);

            return;
        }

        refreshPopup(popup);

        Point p = popup.getLocationOnScreen();
        Point newPt = getPopupMenuOrigin(popup, p);

        boolean willBeContained = willPopupBeContained(popup, newPt);

        if (usedToBeContained != willBeContained) {
            popup.setVisible(false);
        }

        if (!newPt.equals(p)) {
//            if (!NO_POPUP_PLACEMENT_HACK) {
//                popup.setLocation(newPt.x, newPt.y);
//            }
        }

        if (usedToBeContained != willBeContained) {
            popup.setVisible(true);
        }
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:JPopupMenuUtils.java

示例2: isPopupContained

import javax.swing.JPopupMenu; //導入方法依賴的package包/類
public static boolean isPopupContained(JPopupMenu popup) {
    if (!popup.isShowing()) {
        return false;
    }

    return willPopupBeContained(popup, popup.getLocationOnScreen());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:JPopupMenuUtils.java

示例3: willPopupBeContained

import javax.swing.JPopupMenu; //導入方法依賴的package包/類
private static boolean willPopupBeContained(JPopupMenu popup, Point origin) {
    if (!popup.isShowing()) {
        return false;
    }

    Window w = SwingUtilities.windowForComponent(popup.getInvoker());
    Rectangle r = new Rectangle(origin, popup.getSize());

    return (w != null) && w.getBounds().contains(r);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:JPopupMenuUtils.java

示例4: dynamicChangeToSubmenu

import javax.swing.JPopupMenu; //導入方法依賴的package包/類
public static void dynamicChangeToSubmenu(JPopupMenu popup, boolean usedToBeContained) {
    Object invoker = popup.getInvoker();

    if (!(invoker instanceof JMenu)) {
        return;
    }

    JMenu menu = (JMenu) invoker;

    if (!popup.isShowing()) {
        return;
    }

    if (isProblemConfig()) {
        callRefreshLater2(popup, menu);

        return;
    }

    refreshPopup(popup);

    Point p = popup.getLocationOnScreen();
    Dimension popupSize = popup.getPreferredSize();
    Rectangle popupRect = new Rectangle(p, popupSize);
    Rectangle screenRect = getScreenRect();
    boolean willBeContained = isPopupContained(popup);

    if (!screenRect.contains(popupRect)) {
        /*
         * The menu grew off the edge of the screen.
         */
        menu.setPopupMenuVisible(false);
        menu.setPopupMenuVisible(true);
    } else if (usedToBeContained != willBeContained) {
        /*
         * The menu grew off the edge of the containing window.
         * Use the setVisible() hack to change the menu from
         * lightweight to heavyweight.
         */
        popup.setVisible(false);
        popup.setVisible(true);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:44,代碼來源:JPopupMenuUtils.java


注:本文中的javax.swing.JPopupMenu.isShowing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。