01: /*
02: * MainFrame.java - HelpGui main frame
03: * Copyright (C) 2003 Alexandre THOMAS
04: * alexthomas@free.fr
05: * http://helpgui.sourceforge.net
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: package salomeTMF_plug.helpgui.gui;
23:
24: import javax.swing.JFrame;
25:
26: import salomeTMF_plug.helpgui.util.Out;
27:
28: import salomeTMF_plug.helpgui.HelpGui;
29:
30: /**
31: * Main frame of the help GUI
32: *
33: * @author Alexandre THOMAS
34: */
35: public class MainFrame extends JFrame {
36:
37: MainPanel mainPanel;
38:
39: /** Version of HelpGUI. */
40: public String version = "1.0";
41:
42: /** Standard Constructor. */
43: public MainFrame() {
44: super ("Help Gui");
45: mainPanel = new MainPanel();
46: initFrame();
47: }
48:
49: /** Standard Constructor. */
50: public MainFrame(String helpPath) {
51: super ("Help Gui");
52: mainPanel = new MainPanel(helpPath);
53: initFrame();
54: }
55:
56: /** Standard Constructor. */
57: public MainFrame(String helpPath, String iconsPath) {
58: super ("Help Gui");
59: mainPanel = new MainPanel(helpPath, iconsPath, null);
60: initFrame();
61: }
62:
63: /** Standard Constructor. */
64: public void initFrame() {
65: //Default action on close
66: setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
67: addWindowListener(new java.awt.event.WindowAdapter() {
68: public void windowClosing(java.awt.event.WindowEvent evt) {
69: setVisible(false);
70: }
71: });
72:
73: getContentPane().add(mainPanel);
74: //Pack the window
75: pack();
76: setLocation(100, 100);
77: //Set a message
78: Out.msg("Construction of the GUI", Out.OK);
79: }
80:
81: /** Close the Frame */
82: public void quit() {
83: if (HelpGui.debug)
84: System.exit(0);
85: else
86: setVisible(false);
87: }
88:
89: }
|