I have a constructor that takes a java.awt.Compon ent as an argument:
public DesignContainer (Component comp,...){...}
If I pass it a javax.media.ope ngl.GLCanvas object,it takes it,but the lines :
comp instanceof GLCanvas -returns false
GLCanvas canv=(GLCanvas) comp -gives ClassCastExcept ion
(-->I cannot downcast)
AND
comp.getClass() .toString().equ als("class javax.media.ope ngl,GLCanvas") - returns true
I am puzzled:
is the object I am passing a GLCanvas or what?!! how can I verify what it is because I need to downcast...
The interesting thing is that the program DOES draw a GLCanvas,so it should be right...(but I can't continue my work if I can't test for GLCanvas,i use it a lot in my project)
public DesignContainer (Component comp,...){...}
If I pass it a javax.media.ope ngl.GLCanvas object,it takes it,but the lines :
comp instanceof GLCanvas -returns false
GLCanvas canv=(GLCanvas) comp -gives ClassCastExcept ion
(-->I cannot downcast)
AND
comp.getClass() .toString().equ als("class javax.media.ope ngl,GLCanvas") - returns true
I am puzzled:
is the object I am passing a GLCanvas or what?!! how can I verify what it is because I need to downcast...
The interesting thing is that the program DOES draw a GLCanvas,so it should be right...(but I can't continue my work if I can't test for GLCanvas,i use it a lot in my project)
Comment