//MiniEdit.java
public class MiniEdit extends JFrame {
private DesktopManager manager;
private JDesktopPane desktop;
private MiniToolBar toolbar;
private MiniEdit theApp;
private MiniActions actions;
public MiniEdit() {
toolbar = new MiniTooBar(this);
action = new MiniActions(this);
desktop = new JDesktopPane();
getContentPane().add(desktop, "Center");
manager = new DefaultDesktopManager() {
public void activateFrame(JInternalFrame f) {
super.activateFrame(f);
}
};
desktop.setDesktopManager(manager);
//Setup the menubar
JMenuBar menubar = new JMenuBar();
setJMenuBar menubar;
//Setup the menus
JMenuFile file = new FileMenu(actions);
menubar.add(file);
addWindowListener(new WindowAdapter() {
public void windowClosing (WindowEvent e) {
System.out.println(e);
close();
}
});
getContentPane().add(toolBar, BorderLayout.NORTH);
}
public void addToDesktop(JInternalFrame internalFrame) {
desktop.add(internalFrame);
internalFrame.show();
}
public void quit() {
this.dispose();
System.exit(0);
}
}
|