• 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

Usefulness of Inner Classes

 
Ranch Hand
Posts: 110
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good Evening Everyone,

This post is connected to my last post "How can two different objects receive notification of the same event?"

A correct solution to that specific problem was provided by Omar Rashwan - thank you Omar.

However, I realised that it was not the question I should have been asking in the first place - comments from Campbell Ritchie provided an impetus.

So I re-analysed the problem, with simple diagrams, and found that the use of the INNER CLASS provided a much more elegant solution.

That re-analysis has resulted in a short article Usefulness of Inner Classes click on link that simply encapsulates the problem and provides the solution (without the nitty gritty of my project). I hope that people faced with brain-warp, as I was, might find it useful.

The implementation of the inner class solution appears in the source code below:








 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a question?
 
Mohammed Azeem
Ranch Hand
Posts: 110
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh crikey no!

Just thought I'd share something that realised today.
 
Mohammed Azeem
Ranch Hand
Posts: 110
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok so the forums are just for posting questions/problems.

Got it.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohammed Azeem wrote:Ok so the forums are just for posting questions/problems.



Well, not really. It's just that we're surprised when people post solutions instead of questions, because people almost never do that. But there's certainly nothing wrong with it, and maybe someday somebody searching the forum will find your post and find it useful.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohammed Azeem wrote:Ok so the forums are just for posting questions/problems.


Like Paul said, not really. But I've seen so may instances of people posting code and forgetting to ask the question that I wanted to be sure

That said, AWT has been obsoleted by Swing around 15 years ago, so there aren't going to be a lot of people to adopt your code. The same principle does apply in Swing though.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic