This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" java.lang.ClassCastException  RSS feed

 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to create a Java class that imports X3D models and displays them. And I have the X3D model called test.x3d saved in the Netbeans project. My code is

And the error that I'm getting is

Of what I can gather, SimpleAWTSurface is not an instance of JComponent on line 23 and called from line 69 but I don't know how to fix it
 
Campbell Ritchie
Marshal
Posts: 55793
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It suggests that an AWT surface is not a JComponent. That is not surprising; AWT preceded Swing and JComponent extends Container. I think the chances of your being able to cast that surface to a Swing component is slim. Please find out how old that code is, since AWT went out of fashion with Swing was introduced, about 1998.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how old the code is as I got given it to try and modify it. But I've just created another class that I want the same end goal of to display X3D models, but I'm still getting the error. The Jars that I'm using are:

aviatrix3d-all_2.2.0, aviatrix3d-all-swt_2.2.0, aviatrix3d-core_2.2.0, aviatrix3d-glsl_2.2.0, aviatrix3d-utils_2.2.0, gluegen-rt, gluegen-rt-natives-linux-amd64, gluegen-rt-natives-windows-amd64, gluegen-rt-natives-windows-i586, jhall, joal, joal-natives-linux-amd64, joal-natives-windows-amd64, joal-natives-windows-i586, jogl-all, jogl-all-natives-linux-amd64, jogl-all-natives-windows-amd64, jogl-all-natives-windows-i586, org.j3d.aviatrix3d_2.2.0, xj3d.browser_2.1.0-nps, xj3d.cadfilter_2.1.0-nps, xj3d.replica_2.1.0-nps, xj3d.2.1-3rdparty-nps, xj3d-2.1-nps
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!