• Post Reply Bookmark Topic Watch Topic
  • New Topic

Wrapper class

 
shriram raj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am involved in a project which reqiures creating our own
Wrappper classes for our appln. For example, i want to create a button
which should not extend or implement ActionListeners directly.i will create
my own button class which inside will call the java.awt.button class
or any Listeners. i tried to search,but in vain.
Can anyone tell me how to write my own wrapper class.
Thanks in Advance,
Shriram
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this will help you.
public abstract class BaseButton extends JButton implements ActionListener
{
....
....
....
public actionPerformed(ActionEvent ae)
{
doThisOnButtonPress();
}
protected abstract void doThisOnButtonPress();
}
public class CustomButton extends BaseMutton
{
....
....
public void doThisOnButtonPress()
{
....
....
}
}
The BaseButton contains skeleton - basic functionality, and the classes extending it will have customised functionality.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!