473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Freaky ClassCastException

I have a constructor that takes a java.awt.Component as an argument:
public DesignContainer(Component comp,...){...}
If I pass it a javax.media.opengl.GLCanvas object,it takes it,but the lines :
comp instanceof GLCanvas -returns false
GLCanvas canv=(GLCanvas)comp -gives ClassCastException
(-->I cannot downcast)
AND
comp.getClass().toString().equals("class javax.media.opengl,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)
Oct 4 '07 #1
1 1173
r035198x
13,262 8TB
I have a constructor that takes a java.awt.Component as an argument:
public DesignContainer(Component comp,...){...}
If I pass it a javax.media.opengl.GLCanvas object,it takes it,but the lines :
comp instanceof GLCanvas -returns false
GLCanvas canv=(GLCanvas)comp -gives ClassCastException
(-->I cannot downcast)
AND
comp.getClass().toString().equals("class javax.media.opengl,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)
Have a look at this
Oct 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Christine Zhou | last post by:
Hi, We have a customized HttpServletRequest object, when we run the application on webshpere 4.0.7,got a ClassCastException on this object, but was Ok on WAS4.0.1, Anyone know why, is this...
3
by: Jon-Paul Dobson | last post by:
Hi, We have an applet that implements the MouseListener interface but when trying to add the applet to the glasspane of another applet a classcastexception is thrown. This all seemed to work...
5
by: Casper B | last post by:
Since I am only able to pass simple beans around using my Web Service framework, I wonder how to incorporate business logic around these beans. My idea was to let my Beans be the base class and...
1
by: Chris | last post by:
I use websphere connection pooling and had a failure attempting a CLOB.createTemporary. tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); Here's an excerpt of the exception...
1
by: Johannes Lebek | last post by:
Hi there, I made some changes to my XSL stylesheet and now Xalan 2.5.1 is facing ClassCastExceptions. I'm pretty sure, that the changes I made should work (they are quite complicated -- I'd like...
1
by: kanthi84 | last post by:
hi, while i was trying to insert value into a blob column, i got an exception saying java.lang.ClassCastException: com.evermind.sql.OrclResultSet
1
by: mrityunjay11 | last post by:
String description = ""; String query1 = ""; int grade_autoid,count=0; rSet1= DBHelper.getQueryResult(query); %> ...
2
by: star111792 | last post by:
helo all, i am working with JSP and EJBs. i have written a simple code for verifying username and password of user by using session beans. my problem is that i m getting exception named...
4
by: eazyigz | last post by:
I downloaded Junit 4.5 and am using the TestRunner class to test the AllTests class in the junit/tests package. I am issuing the following command at a DOS prompt: java -classpath junit-4.5.jar;....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.