package framework; import javax.swing.*; import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.io.*; import java.lang.reflect.*; import java.util.*; /** Base class for the application's main window.
Includes working File and Help menus.
Example:
public class MyAppWindow extends AppWindow {
public MyAppWindow(MyModel model) {
super(model);
// add custom views and windows here
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
MyModel model = new MyModel();
AppWindow gui = new MyAppWindow(model);
gui.setVisible(true);
}
});
}
}
*/
public class AppWindow extends JFrame {
protected JMenu fileMenu;
protected JMenu helpMenu;
/**
Subclasses can add more menus to this menu bar
*/
protected JMenuBar menuBar;
/**
Subclasses of AppView should be added to this set.
*/
protected SetThis method also sets the model and adds the view to the JFrame, which I think works for Java 5.0. @param view The new view */ protected void addView(AppView view) { views.add(view); view.setModel(model); add(view); } /** Called when the user selects Help/Help. This method should be overridden by subclasses. */ public void help() { FrameworkUtils.error("Sorry, this item isn't implemented"); } /** Called when the user selects Help/About. */ protected void about() { JOptionPane.showMessageDialog(null, new String[] {"Application Framework", "Copyright(c) 2001", "All rights reserved"}, "About", JOptionPane.INFORMATION_MESSAGE); } }