📄 e978. enumerating all the views in a jtextcomponent.txt
字号:
// Create a text component
JTextComponent textComp = new JTextPane();
// Get the root view
View v = textComp.getUI().getRootView(textComp);
// Walk the view hierarchy
walkView(v, 0);
// Recursively walks a view hierarchy
public void walkView(View view, int level) {
// Process view...
// Get number of children views
int n = view.getViewCount();
// Visit the children of this view
for (int i=0; i<n; i++) {
walkView(view.getView(i), level+1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -