enable multiple jtext in a jpanel

hi allI have a jpanel containing different jtextfield .I want that when i click a button all the jcomponents are enabled in one shot. Any idea?Regards
[178 byte] By [gionnyDeepa] at [2007-11-27 6:19:00]
# 1
call setEnabled(true) for all components that you want to enable in button's action event
AnanSmritia at 2007-7-12 17:33:18 > top of Java-index,Desktop,Core GUI APIs...
# 2
I have hundreds of text field in different jpanel.Is there a way for disabling all of them in one onstructions?
gionnyDeepa at 2007-7-12 17:33:18 > top of Java-index,Desktop,Core GUI APIs...
# 3

You can use the same concept SwingUtilities updateComponentTreeUI function is using.

This is the code for updateComponentTreeUI function.

This is a recursive function that iterates over a component and its descendants and calls updateUI for each JComponent.

Just modify the code to setEnabled instead of updateUI.

private static void updateComponentTreeUI0(Component c) {

if (c instanceof JComponent) {

((JComponent) c).updateUI();

}

Component[] children = null;

if (c instanceof JMenu) {

children = ((JMenu)c).getMenuComponents();

}

else if (c instanceof Container) {

children = ((Container)c).getComponents();

}

if (children != null) {

for(int i = 0; i < children.length; i++) {

updateComponentTreeUI0(children[i]);

}

}

}

Rodney_McKaya at 2007-7-12 17:33:18 > top of Java-index,Desktop,Core GUI APIs...