• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDialog with ClassCastException ?!??!

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
:-(

ohhhhhhhhhhh

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

gggggggggggggggg
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic