This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JPanel Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPanel Problem" Watch "JPanel Problem" New topic

JPanel Problem

Garry Kalra
Ranch Hand

Joined: May 25, 2001
Posts: 111
I have a doubt.
I thought making a JPanel disabled would make all its components disabled, but i don't think this happens. Is there a way to desable all the components on the JPanel, or do i need to disable them individually.
Any help will be appreciated.
Gaurav Kalra
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

As far as I know, you have to disable each component. A JPanel is a Container. I think you can only disable Components.
You could use the getComponent() method which would throw all the components into an Object Array and then parse through them and disable them using a for loop. Maybe myComponent.setEnabled(false) for each component would be easier though.
Happy Coding

GenRocket - Experts at Building Test Data
Garry Kalra
Ranch Hand

Joined: May 25, 2001
Posts: 111
Thanks for the Information.
Garry Kalra
subject: JPanel Problem