Customizing the main window

As mentioned in chapter ' The class FrmMain', this class is extending class JPanel by adding some extra fields and methods. To construct these extras as well as to set up the way the window initially is displayed, method customizeFrame is used.

After setting the window title and size, method customizeFrame gets a reference to the windows content pane, and adds a newly created instance of BorderLayout to it. Finally it creates a new JTabbedPane and adds it to the center of the content pane. As the JTabbedPane is the only component of the application's main window, it covers all of its visible region except for the menu and title bar.

JTabbedPane jtpDocs

A reference to FrmMain's tabbed pane is kept in field jtpDocs as a central place for pointing to all documents open in the main window. Whenever a document is created or opened, it is added to jtpDocs for display.

Thus, jtpDocs is a good place to look for a certain document. If the currently active document shall be addressed for instance, jtpDocs.getSelectedIndex points to the currently selected tab in the JTabbedPane and jtpDocs.getComponentAt fetches the component contained in this tab, which in turn would be the currently active document.