ContextMenu.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:ArduBlock 作者:
/**
 * Returns the right click context menu for the specified JComponent.  If there is 
 * none, returns null.
 * @param o JComponent object seeking context menu
 * @return the right click context menu for the specified JComponent.  If there is 
 * none, returns null.
 */
public static PopupMenu getContextMenuFor(Object o) {
    if (o instanceof RenderableBlock) {
        if (((RenderableBlock) o).hasComment()) {
            if (!removeCommentMenuInit) {
                initRemoveCommentMenu();
            }
            activeComponent = o;
            return removeCommentMenu;
        } else {
            if (!addCommentMenuInit) {
                initAddCommentMenu();
            }
            activeComponent = o;
            return addCommentMenu;
        }
    } else if (o instanceof BlockCanvas) {
        if (!canvasMenuInit) {
            initCanvasMenu();
        }
        activeComponent = o;
        return canvasMenu;
    }
    return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号