Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Wrapper Classes  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam involved in a work of creating wrapper classes for my
import mywork.awt.*;
import mywork.awt.event.*;
( i use java.awt.*;java.awt.event.* inside my package)
I use the same names as the originals namely
This is my sample file. I explain the problem after this::
import mywork.awt.*;
import mywork.awt.event.*;
public class ButtonSample extends Frame implements ActionListener
public ButtonSample()
setTitle("Button Sample");
Button print = new Button("Print Hello");
public void actionPerformed(ActionEvent ae)
String button = ae.getActionCommand();
if (button.equals("Print Hello"))
System.out.println("Hello Printed");
public static void main(String []args)
new ButtonSample();
Actually, the program should run as i extended or implemented
the originals in my package.(mywork).
But i get a serious problem when i run this: As,
"" class ButtonSample must be declared abstract. It does not define void actionPerformed(java.awt.event.ActionEvent) from interface java.awt.event.ActionListener.
public class ButtonSample extends Frame implements ActionListener ""
Is there any solutuions to override these???
author and iconoclast
Posts: 24203
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea why you'd want to provide your own like-named replacements for something like ActionListener, but I won't ask.
Anyway, because you've introduced this enormous level of confusion, you've got to introduce some serious ugliness to fix it: use the fully qualified name of every class. So since the compiler wants you to implement an actionPerformed() method with the original ActionEvent as an argument, you'll have to write it as
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!