Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make a descendant class that does nothing extra

 
Mark van de Veerdonk
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic