package gradertool; //import gradertool.view.view.*; import javax.swing.*; import java.awt.*; /**** * * Class GraderToolUI is the top-level class for the GUI prototype. It * extends a JFrame, which is the Swing class most often used for stand-alone * GUI windows. *

* GraderToolUI's constructor creates a menubar, and then calls the * constructors for the other prototype GUIs. These constructors, in turn, * create the menus that appear in the menubar, as well as the dialogs and * display windows that appear in response to menu item selection and button * presses. * */ public class GraderToolUI extends JFrame { /** * Construct this with its menubar and Quick Launch display window. * Lower-level GUI classes are in turn responsible for constructing their * own GUI components, including the menus, menu items, dialogs, and * display windows. *

* This constructor also performs the following two initializations: (1) * set the title of the window to "Grader Tool"; (2) call the * JFrame.pack() method, which tells swing to perform the necessary window * layout computations. Neglecting to call the pack method can lead to * improperly sized JFrames, so make sure you don't forget to do it. */ public GraderToolUI() { /* * Construct the menubar. */ menuBar = new JMenuBar(); /* * Set the JFrame's built-in menu bar. */ setJMenuBar(menuBar); /* * Set the Menu Bars size. */ menuBar.setPreferredSize(new Dimension(350, 25)); /* * Call the constructors for the top-level classes in each of the GUI * prototype packages. */ constructSubGUIs(); /* * Add the menus. These will have been constructed by the subGUI * classes, and made available in with a getMenu method. */ composeMenuBar(); /* * Bring up the Quick Launch display window. */ (quickLaunchDisplay = quickLaunchUI.getQuickLaunchDisplay()). setVisible(true); /* * Set the window title, which will appear in the banner of the window. */ setTitle("Grader Tool"); /* * Call JFrame.pack to have Java size up the window properly. */ pack(); } /** * Call the constructor for each of the sub GUIs. */ protected void constructSubGUIs() { fileUI = new gradertool.view.FileUI(); editUI = new gradertool.view.EditUI(); viewUI = new gradertool.view.ViewUI(); // adminUI = new gradertool.view.admin.AdminUI(); toolsUI = new gradertool.view.ToolsUI(); // windowsUI = new gradertool.view.windows.WindowsUI(); windowUI = new gradertool.view.WindowUI(); helpUI = new gradertool.view.HelpUI(); quickLaunchUI = new gradertool.admin.QuickLaunchUI(); } /** * Compose the menubar by adding each menu to it. */ protected void composeMenuBar() { menuBar.add(fileUI.getMenu()); menuBar.add(editUI.getMenu()); menuBar.add(viewUI.getMenu()); // menuBar.add(adminUI.getMenu()); menuBar.add(toolsUI.getMenu()); // menuBar.add(helpUI.getMenu()); menuBar.add(windowUI.getMenu()); menuBar.add(Box.createHorizontalGlue()); menuBar.add(helpUI.getMenu()); } /*-* * Data fields */ /** The top-level menu bar. */ protected JMenuBar menuBar; /** The prototype UI for file-related functionality. */ protected gradertool.view.FileUI fileUI; /** The prototype UI for editing functionality. */ protected gradertool.view.EditUI editUI; /** The prototype UI for viewing functionality. */ protected gradertool.view.ViewUI viewUI; /** The prototype UI for administrative functionality. */ //protected gradertool.view.admin.AdminUI adminUI; /** The prototype UI for options functionality. */ protected gradertool.view.ToolsUI toolsUI; /** The prototype UI for windows functionality. */ protected gradertool.view.WindowUI windowUI; /** The prototype UI for help functionality. */ protected gradertool.view.HelpUI helpUI; /** The prototype UI for the quick launch functionallity. */ protected gradertool.admin.QuickLaunchUI quickLaunchUI; /** Quick Launch initial window. */ protected gradertool.admin.QuickLaunchDisplay quickLaunchDisplay; }