I am trying to build a small notepad application using the Java Swing library. I have a main function which calls a constructor of JFrame (NotepadClass)
. In this NotepadClass
I have a MenuDesigner
class something like this:
this.setJMenuBar(new MenuDesigner());
The MenuDesigner
class extends JMenuBar
which calls actionListener (MenuActionListener
) which is written in another class.
Now my question is: If I click on "new" menuItem
, the title which is in NotepadClass
should change. How do I access a class that is two levels up?
Which concept of Java should I use to accomplish this?