Not that I can see. Your classes have names, even though they are too short to use in real life (A or B). A class like "new ActionListener" hasn't got a name.
s ther some concept of anonymous class involved here?
There isn't a simpler way. Find examples in the books (unfortunately you might have a long search to find them in the Java Tutorial). Copy them. But don't copy the anonymous classes line by line, write them out the way I showed you earlier. It is not easy remembering such classes. That is why you buy books with examples in, and why you look in the API and tutorials.
Please help it out in more simpler way.
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton