How can I create a multiple document interface(MDI) application in Java?
Created May 4, 2012
Sandip Chitale
Well the Multiple Document Interface is different things to different people. If you are talking about visual aspects of MDI i.e. just the set of child windows(MDICHildWindows) that stay inside the main application window. That can be achieved simply by using the following classes from Swing -
javax.swing.JDesktopPane javax.swing.JInternalFrame javax.swing.JInternalFrame.JDesktopIcon
Mind you though - this still does not behave exactly like M*Soft's implementation of MDI. The differences are as follows -
- The maximized JInternalFrames still have the TitleBar and other buttons like minimize/restore/close do not merge into main application's menubar.
- Multiple layers are supported in the JDesktopPane (being a subclass of JLayeredPane).
- Automatic switching of the MenuBar based on which child window has the focus is not supplied. You have to manage it.
If you are talking about the full blown notion of MDI i.e.
Application DocumentFactory or ModelFactory Document or Model View Frame and MDIChildWindow
You will have to do it yourselves.