Results 1 to 1 of 1
- 01-19-2010, 07:37 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 1
- Rep Power
- 0
Cannot cast JNLPAppletLauncher to itself
I am trying to communicate between two applets on a web page for a project at work. I have one applet which runs a scanner in native code, and another applet that is supposed to display the scanned images on the screen. I am using getAppletContext().getApplet() to get a reference to the other applet. The applets are launched using JNLP, so when I try to get the scanner applet I get the JNLPAppletLauncher object. My plan was to call the getSubApplet() method on this object to get the actual scanner applet that I want.
The problem is that when I cast the return of getAppletContext().getApplet() into org.jdesktop.applet.util.JNLPAppletLauncher I get the following error:
So it is confirming for me that the object is a JNLPAppletLauncher, but it won't let me cast it to that type.Java Code:java.lang.ClassCastException: org.jdesktop.applet.util.JNLPAppletLauncher cannot be cast to org.jdesktop.applet.util.JNLPAppletLauncher
The code where this happens is:
The only thing anyone could think of is that for some reason two different versions of JNLPAppletLauncher are being loaded and I am trying to cast one version into a different version. I don't see how this would have happened though.Java Code:Scanner scanner = (Scanner) ((org.jdesktop.applet.util.JNLPAppletLauncher) getAppletContext().getApplet("scanner")).getSubApplet();
Any help would be greatly appreciated.
Similar Threads
-
Need Help with Class Cast Exception
By soxfan714 in forum New To JavaReplies: 2Last Post: 11-03-2011, 04:33 PM -
Help with cast, equals and clone
By nellaf in forum New To JavaReplies: 1Last Post: 04-19-2009, 06:57 AM -
Cast From Image to String
By Deepa in forum New To JavaReplies: 4Last Post: 03-03-2009, 02:07 PM -
class cast exception
By venkatallu in forum New To JavaReplies: 2Last Post: 09-02-2008, 09:50 PM -
How can I cast Object as an int
By romina in forum New To JavaReplies: 1Last Post: 07-18-2007, 11:20 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks