Forums Register Login

Wrapper class

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
Water! People swim in water! Even tiny ads swim in water:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 832 times.
Similar Threads
paint or paintComponent method
wrapper class
Generic
How can we create our own String class in java?
Insert 2nd class tu main class
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:39:43.