Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDialog with ClassCastException ?!??!

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the root of e.getSource() is not a JDialog
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:-(

ohhhhhhhhhhh

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

gggggggggggggggg
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic