本文整理匯總了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);
}
}
示例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;
}
示例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;
}