Meaningless Drivel is fun!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
resize jdialog
disable previous JFrame upon new JFrame popup
adding panel into JDialog at run time problem
FileDialog save as FREEZE ?!?!
What if the FileDialog is invoked from a JDialog???