Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Question on JPanel

Reply
Thread Tools

Question on JPanel

 
 
Soundar
Guest
Posts: n/a
 
      01-30-2005
If I set a JPanel to not enabled

pane.setEnabled(false);

I am still able to select the components that are the panel's children.
Coming from a VB background, I find this strange. If you disable a
panel, all its children should be automatically disabled. Am I doing
something
wrong? Do I have to disable each child one by one?
-----------
I am reposting this question since I did not get a response to a
previous post of the same question...probably no one read it

 
Reply With Quote
 
 
 
 
Ann
Guest
Posts: n/a
 
      01-30-2005

"Soundar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> If I set a JPanel to not enabled
>
> pane.setEnabled(false);
>
> I am still able to select the components that are the panel's children.
> Coming from a VB background, I find this strange. If you disable a
> panel, all its children should be automatically disabled. Am I doing
> something
> wrong? Do I have to disable each child one by one?


Did you add them one by one? Don't you like to have a choice?


 
Reply With Quote
 
 
 
 
elmar.schraml@gmail.com
Guest
Posts: n/a
 
      01-31-2005
You are corredt, the children of the panel are still enabled. In most
cases this is a nuisance, however it does have its uses. For example,
think about a tabbed or scroll-pane where you might want to prohibit
the user from doing anything with the panel itself (scrolling, changing
tabs etc), but still want him to be able to use the components on the
pane.

To reduce the work of disabling all the components one by one, you
could put them into a Collection, and hand this collection off to a
generic function that iterates through the collection and does
often-needed stuff with each component.

regards,
Elmar

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JPanel inside JPanel inside JFrame t1m1976 Java 1 11-07-2010 09:47 PM
[JPanel] Drop Down JPanel Raphael Jolivet Java 1 07-18-2008 12:30 AM
Add a JPanel to a JPanel... Andreas Beresko Java 6 07-16-2004 12:10 AM
Resizing a jpanel and the objects on it???????? steve smith Java 0 07-10-2003 06:22 PM
JPanel and Graphics Scott Java 0 07-02-2003 07:05 PM



Advertisments