The first getParent
will return sun.applet.AppletViewerPanel
and second will return sun.applet.AppletViewer
.
Here is the declaration of AppletViewer
class
public class sun.applet.AppletViewer extends java.awt.Frame ...
That's why you can downcast AppletViewer
into Frame
.
I think, You are mixing
getParent()
method with theinheritence
. Hereparent
meansthe parent container of this component
not component's immediate super-class.
For more info have a look at Component#getParent().