aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JDialog with ClassCastException ?!??! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JDialog with ClassCastException ?!??!" Watch "JDialog with ClassCastException ?!??!" New topic
Author

JDialog with ClassCastException ?!??!

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Guys,

I want to invoke a jdialog and I'm using this line of code:

Component c = SwingUtilities.getRoot((Component)e.getSource());
JDialog subDialog = (JDialog)c;

It works GREAT in the entire project;

but for some reason, in diff class I get this message:
java.lang.ClassCastException
at CustomizeAgent.actionPerformed(CustomizeAgent.java:315)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)...


WHY??? any idea how to correct it?
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
the root of e.getSource() is not a JDialog
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
:-(

ohhhhhhhhhhh

right!!! thanks - I corrected it and it works.

gggggggggggggggg
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDialog with ClassCastException ?!??!
 
Similar Threads
disable previous JFrame upon new JFrame popup
FileDialog save as FREEZE ?!?!
resize jdialog
What if the FileDialog is invoked from a JDialog???
adding panel into JDialog at run time problem