Every time I think I am really making progress in understanding object oriented programming, I run into something that makes me have to go back and start all over again... This time its "subclassing".
I believe that I understand the basics inheritance and overriding, but when I start to develop a "structure" for an application, I get lost. If I want to created a window on the screen, I would use Main method, to allow this code to be runnable. I would also use a constructor to initialize my application. Then I would use a JFrame, JPanel and paintComponent to do the actual work of building and displaying my application. But the question always seems to be, "What is the best approach?" OR "Which approach is the best with respect to Object Oriented Programming?"
So, I could put almost everything inside the main() method, but that is obviously not very OOP. I could have the main() method call the constructor and then put the define the JFrame and JPanel objects in that method. I could extend the whole class with "extends JFrame" or perhaps better "extends JPanel" but its not intuitively obvious how that helps me or makes the application "more OOP".
So I have all these "tinkertoy" parts and I know how one connects to the other, but I just don't seem to get the "why" part, or how to know what approach to take.
I have read lots of tutorials, but its just not sinking in.
Thanks,
Tahoe