The geditcom.JNFramework package provides an application framework for a multi-document application. The application starts with a subclass of JNApplication to control the application. Each document is a subclass of JNDocument. If a document needs more than one window, it creates them with a subclass of JNChildWindow. The framework has a built-in "About" box and makes it easy to provide help and to track and edit application preferences.

See each class in the package for the bulk of the documentation. The following is the minimal code needed to get an application started. This template defines a basic, multi-document, plain-text editor. The application can open and save files, edit text (with undo support), do find and replace, and show an about box on the application. It automatically accounts for some MacOS vs. Windows differences (e.g., location of menu bar and menu command keyboard shortcuts). When a window is closed or the application is quit, the user has the option to save any documents that have been changed. Opening and closing of files will enforce the preferred file extensions (although other extensions can be used if desired). A "Window" menu is included that automatically tracks all currently opened document windows and child windows of documents (if used).

Write a Subclass of JNApplication
The first step is to write a JNApplication subclass. Typically the name of this subclass will be the name of your application. Here is a minimal template named here as TextEdit.java:
import geditcom.JNFramework.*;

public class TextEdit extends JNApplication
{
    public TextEdit()
    {   super("TextEdit","Version 1.0","Java application for plain text editing");
        if(!finishLaunching(false))
            newDocument("TextDoc");
    }

    public void newDocument(String docType)
    {    openUntitledDocument(new TextEditDocument());
    }
	
    public JNDocument createDocumentObject(String docType)
    {    return new TextEditDocument();
    }

    public static void main(String[] args)
    {   javax.swing.SwingUtilities.invokeLater(new Runnable()
        {   public void run()
            {   createAndShowGUI();
            }
        });
    }
	
    private static void createAndShowGUI()
    {   JNPreferences.createPrefs("com/geditcom/TextEdit");
        JNPreferences.setCanEditPreferences(false);
		
        // select application options
        setLookAndFeel(true,true);
        setStaggers(10,10,10,10,15,20,6);
		
        // set some optional info
        JNApplication.copyright="Copyright 2011, All Rights Reserved";
        JNApplication.author="Written and documented by John A. Nairn";
        JNApplication.webSite="http://www.cof.orst.edu/cof/wse/faculty/Nairn/";
 		
        // set document types
        String[] exts={"txt"};
        JNDocument.setDocumentType("TextEdit","TextEdit Document",exts);

        // create instance of this JNApplication subclass
        new TextEdit();
    }
}
Write a Subclass of JNDocument
Each document is defined by a subclass of JNDocument. Here the document is a subclass JNPlainTextDocument, which is provided in the framework for simple, plain text editing windows. Below is a minimal template named here as TextEditDocument.java. This minimal template need not handle any tasks involved in loading text from files or saving changed text because that is all handled by the super class JNPlainTextDocument.
import geditcom.JNFramework.*;
import javax.swing.*;

public class TextEditDocument extends JNPlainTextDocument
{
    TextEditDocument()
    {   super("TextDoc");
        setFramePrefs("Editing Window Width",800,"Editing Window Height",1200);
        makeMenuBar();
        finishFrameworkWindow(true);
    }
	
    protected void makeMenuBar()
    {   JMenuBar menuBar = new JMenuBar();
        if(!JNApplication.isMacLNF())
            menuBar.add(defaultApplicationMenu());
        menuBar.add(defaultFileMenu());
        menuBar.add(defaultEditMenu(true));
		
        JMenu menu = new JMenu("Window");
        if(JNApplication.isMacLNF())
        {   menu.add(JNApplication.main.getOpenHelpAction());
            menu.addSeparator();
        }
        menuBar.add(menu);
        setWindowMenu(menu);
		
        setJMenuBar(menuBar);
    }
}
Editing Preferences
This minimal example uses preferences, but cannot edit them. The preferences are initialized in the JNApplication subclass and here set to not be editable. To add more preferences features and a window for editing them, see the JNPreferences documentation.
Add a Help File
All good applications should provide help information. See the JNHelpWindow documentation for the details.