The itemStateChanged method
From: Tim Mierzejewski (timmierz_at_yahoo.com)
Date: 06/21/04
- Next message: VisionSet: "Re: Davadoc and methods"
- Previous message: Poochie: "Davadoc and methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 21 Jun 2004 14:58:33 GMT
I have a List and a Choice on an applet and I want a TextField below them to
display the selected text of each one. Everything's good until runtime when
I actually select one, I get errors (below). There is an ItemListener on
both the List and the Choice. First, here is my itemStateChanged method:
public void itemStateChanged(ItemEvent ie)
{
Choice selBrgd = (Choice)ie.getItemSelectable();
List selType = (List)ie.getItemSelectable();
tfResult.setText("A " + selBrgd.getSelectedItem() + " " +
selType.getSelectedItem());
}
And here are the errors:
java.lang.ClassCastException
at JavaTest.Chapter13.CardChoice.itemStateChanged(CardChoice.java:51)
at java.awt.Choice.processItemEvent(Unknown Source)
at java.awt.Choice.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Thanks,
Tim
- Next message: VisionSet: "Re: Davadoc and methods"
- Previous message: Poochie: "Davadoc and methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|