Swingのウィンドウ列挙関数を改訂した。
JMenuの子ウィンドウはJComponent.getComponentでは取得できない。
どうやらクラス毎に特殊な子ウィンドウ取得が必要のようだ。
Vector<JComponent> collcetApplicationJComponents() { Vector<JComponent> list = new Vector<JComponent>(); for(Frame f : Frame.getFrames()) { if(f instanceof JFrame) { collectComponets(((JFrame)f).getRootPane(), list); } } return list; } void collectComponets(JComponent root, Vector<JComponent> list) { for(Component c : getComponents(root)) { if(c instanceof JComponent) { list.add((JComponent)c); collectComponets((JComponent)c, list); } } } Component[] getComponents(JComponent root) { if(root instanceof JMenu) { return ((JMenu)root).getMenuComponents(); } else { return root.getComponents(); } }