시소당
// 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);
}
}