dcsimg
Create a List of Custom Components inside a JPanel/Container
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aja_Woods
Posted On:   Monday, May 14, 2001 05:36 PM

Hi I'm Trying to created a list of custom components inside a JPanel. The custom component - ConditionField extends JPanel it contains a textfield and a button. When I add several of these "ConditionField" components to a JPanel and then try to access these components - the panel only sees one of the ConditionField components. For instances, if I add 10 ConditionField components using a 'for' loop to my JPanel class - and then call getComponentCount() on the JPanel, the count returns = 1 if the JPanel containing the list of components is then validated - the count returned is correct but the ActionListener does not work for the button in the   More>>

Hi I'm Trying to created a list of custom components
inside a JPanel.

The custom component - ConditionField extends JPanel
it contains a textfield and a button.

When I add several of these "ConditionField" components
to a JPanel and then try to access these components -
the panel only sees one of the ConditionField components.

For instances, if I add 10 ConditionField components using a
'for' loop to my JPanel class - and then call
getComponentCount() on the JPanel, the count returns = 1

if the JPanel containing the list of components is then
validated - the count returned is correct but the ActionListener
does not work for the button in the ConditionField.

Once trying to debug the problem I got an exception stating
"that the getGraphics method is not defined " but I can't
repeat the error so I'm not exactly sure why it occured.

Do you have any suggestions?
(a) Is there something else that I need to know about creating
custom components?

(b) Should I be able to trigger an event from a custom component?

(c) Why would I not be detecting all of the added components?


Thanks for your help,
Aja

   <<Less
About | Sitemap | Contact