• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to share the same events for multiple components?  RSS feed

 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a tabbed pane with three tabs. Each tab contains the same components. For eg
Tab 1 contains the following

one Label - Login ID
one Text field - Login ID field
one button - Login
one text area - Generate some data
two buttons - Clear and Exit.

I have written one method createPage() and it will place all these components in the tab.
The same method will be used to create components in other tabs, such as Tab 2 and Tab 3.
Is it a good idea to use the same page in other tabs without creating a new components?
I want to handle the events for Login , Clear and Exit buttons. Can we share the same events
to all these buttons?

Give me some pointer

bye for now
sat
 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look into the AbstractAction class that is the good start for you. But i would say that if you really want to reuse the components then take care that you clear the old data carefully. You will have a lot of issues associated with that.

I would personally prefer to have the same method re create the components bnut then it is a personal opinion
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam,

Thanks. It works fine.

bye for now
sat
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!