Forums Register Login

ItemListener: Exception in thread "AWT-EventQueue-1"

+Pie Number of slices to send: Send
I'm getting following errors when trying to implement ItemListener:

Exception in thread "AWT-EventQueue-1" java.lang.ClassCastException: java.awt.Checkbox cannot be cast to java.awt.Choice
at SurveyApplet.itemStateChanged(SurveyApplet.java:68)


Please, advise:

+Pie Number of slices to send: Send
When you get this sort of problem it's best to read the API docs for the class to see what type the method actually returns. The docs say the getItemSelectable() method returns an object of type ItemSelectable (which in your case is the JCheckbox) but you are trying to cast it to a type Choice, which it isn't.
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1164 times.
Similar Threads
ItemListener: checkbox component
Need help with editing variables.
placing images in applets
AWT Applet Instantiation Error
Instantiation Error in AWT Applet code
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:14:44.