M
Matthias Kaeppler
Hello,
I wonder if this is a flaw in my design:
In my program, I introduced an abstract class called VisualizationFrame
which inherits from javax.swing.JInternalFrame (which itself is not
abstract). The point to make it abstract was that it's supposed to be an
ABC by itself: Two other concrete classes, namely DiagramFrame and
StatisticsFrame inherit from it. They need to do special painting, so
this makes sense.
However, I want to force the two concrete classes to override the
paint() method, so I declared it abstract in VisualizationFrame.
Now this leads to some oddities so I have a couple of questions.
1. Since I changed the signature of paint() to be abstract now, will it
hide the superclass paint() method from JInternalFrame?
2. Both concrete classes need to implement the paint() method, but they
also need to call the base class paint() first, to actually draw the
window. But this method is abstract and has no body, so I would have to
call super.super.paint(), which is illegal.
Is that a flaw in my design? Should I simply make paint() in
VisualizationFrame non-abstract? This wouldn't express my intention as
clear, but it would be a lot simpler.
Cheers,
Matthias
I wonder if this is a flaw in my design:
In my program, I introduced an abstract class called VisualizationFrame
which inherits from javax.swing.JInternalFrame (which itself is not
abstract). The point to make it abstract was that it's supposed to be an
ABC by itself: Two other concrete classes, namely DiagramFrame and
StatisticsFrame inherit from it. They need to do special painting, so
this makes sense.
However, I want to force the two concrete classes to override the
paint() method, so I declared it abstract in VisualizationFrame.
Now this leads to some oddities so I have a couple of questions.
1. Since I changed the signature of paint() to be abstract now, will it
hide the superclass paint() method from JInternalFrame?
2. Both concrete classes need to implement the paint() method, but they
also need to call the base class paint() first, to actually draw the
window. But this method is abstract and has no body, so I would have to
call super.super.paint(), which is illegal.
Is that a flaw in my design? Should I simply make paint() in
VisualizationFrame non-abstract? This wouldn't express my intention as
clear, but it would be a lot simpler.
Cheers,
Matthias