wood burning stoves*
The moose likes Beginning Java and the fly likes How to make a descendant class that does nothing extra Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to make a descendant class that does nothing extra" Watch "How to make a descendant class that does nothing extra" New topic
Author

How to make a descendant class that does nothing extra

Mark van de Veerdonk
Greenhorn

Joined: Dec 08, 2004
Posts: 12
Hi,

Can anyone tell me if I'm right about the following: a class behaves EXACTLY the same as its parent class if it implements nothing but the constructors with the parameter list as the ones in the parent class?

This is why I'm asking. I've created a JFrame descendant and it causes errors in the application I'm modifying. And all I did was replace "JFrame.class" with "DefaultRootPane.class" on which newInstance() will be called afterwards. I find this very strange!

Here's my class that I think should behave exactly the same as JFrame:


Thanx, Mark
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
You need to import the classes JFrame and GraphicsConfiguration in your class file. Also add a semi colon after super() in your first constructor
Mark van de Veerdonk
Greenhorn

Joined: Dec 08, 2004
Posts: 12
Thanx Nigel. I'm using Eclipse so I can see instantly what errors remain. Why the semi-colon was there at the time I posted, I can't remember but I'm pretty sure I tried my software using a working version of the class. The import is also present. I've simply left out what I thought would make my post even more lengthy.

So my question remains the same...
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by Mark van de Veerdonk:
it causes errors in the application I'm modifying.
The more specific information you provide, the better the chances of us helping you. Can you explain exactly what kinds of errors happen? Do you get an exception? Give us the stack trace. Does it work mostly but you see oddities in the UI? Describe the oddities. Etc.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make a descendant class that does nothing extra