This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes java.lang.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 "java.lang.ClassCastException" Watch "java.lang.ClassCastException" New topic


anu johncy

Joined: Dec 05, 2011
Posts: 11
hi ,
i try to create simple login page using Eclipse Editor
the code is following :

and one externel classfile having the same package that code is following :

then the error is
java.lang.ClassCastException: eclipsepackage.Login cannot be cast to javax.swing.event.AncestorListener

please support me to solve problem ,
thanks ,

[Edit - added code tags - MB]
John Jai

Joined: May 31, 2011
Posts: 1776

The error occurs because the Login class cannot be cast to the mentioned one. Are you sure you want to add AncestorListener and not the ActionListener? Because the login class implements only the ActionListener.
Matthew Brown

Joined: Apr 06, 2010
Posts: 4344

And Welcome to The Ranch!
wood burning stoves
subject: java.lang.ClassCastException
Similar Threads
Sending password/login info using sockets
How to refresh View in MVC architecture.
Boolean problem
Implementing scanner into a simple login page