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


Java View.getParent方法代碼示例

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


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

示例1: checkChildrenParent

import javax.swing.text.View; //導入方法依賴的package包/類
private static void checkChildrenParent(View v) {
    int cnt = v.getViewCount();
    for (int i = 0; i < cnt; i++) {
        View child = v.getView(i);
        View childParent = child.getParent();
        if (childParent != v) {
            throw new IllegalStateException("child=" + child // NOI18N
                + " has parent=" + childParent // NOI18N
                + " instead of " + v // NOI18N
            );
        }
        checkChildrenParent(child);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ViewUtilitiesImpl.java

示例2: get

import javax.swing.text.View; //導入方法依賴的package包/類
static DocumentView get(View view) {
    while (view != null && !(view instanceof DocumentView)) {
        view = view.getParent();
    }
    return (DocumentView) view;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:DocumentView.java

示例3: get

import javax.swing.text.View; //導入方法依賴的package包/類
/**
 * Find the <code>LockView</code> instance in a view hierarchy
 * by traversing it up to the root view.
 *
 * @param view view in the view hierarchy. <code>null</code> is accepted too.
 * @return valid instance of <code>LockView</code> or null
 *  if there is no <code>LockView</code> instance present
 *  in the view hierarchy of the view is no longer
 *  part of the view hierarchy.
 */
public static LockView get(View view) {
    while (view != null && !(view instanceof LockView)) {
        view = view.getParent();
    }
    
    return (LockView)view;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:LockView.java


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