View Javadoc

1   /***
2   *
3   * The owl-s matcher software is subject to the GNU Lesser General
4   * Public License Version 2.1 (the "License"). You may not copy or use this
5   * file, in either source code or executable form, except in compliance
6   * with the License. You may obtain a copy of the License at
7   * http://www.fsf.org/licenses/lgpl.txt or http://www.opensource.org/.
8   *
9   * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied without
11  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  * PURPOSE. See the License for the specific language governing rights and
13  * limitations under the License.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this distribution; if not, write to the
17  *
18  * Free Software Foundation, Inc.,
19  * 59 Temple Place, Suite 330,
20  * Boston, MA  02111-1307 USA
21  *
22  * Copyright (C) 2003-2004
23  * TU Berlin, FG IVS
24  * Stefan Tang,
25  * Christoph Liebetruth,
26  * Michael C. Jaeger, 
27  *
28  * More information available at http://ivs.tu-berlin.de/
29  *
30  * $Id$
31  *
32  */
33  package de.tuberlin.ivs.owl.gui;
34  
35  import javax.swing.UIManager;
36  import java.awt.*;
37  
38  /***
39   * The main class for the GUI application. Constructs the GUI.
40   *
41   * @author Stefan Tang (steftang@stanford.edu), Christoph Liebetruth (christophl@voelcker.com)
42   * @version 1.1
43   */
44  
45  public class MatchingGUI {
46    boolean packFrame = false;
47  
48    /***
49     * Constructor. Constructs the main window and centers it on the screen.
50     */
51    public MatchingGUI() {
52      MainFrame frame = new MainFrame();
53      //Validate frames that have preset sizes
54      //Pack frames that have useful preferred size info, e.g. from their layout
55      if (packFrame) {
56        frame.pack();
57      }
58      else {
59        frame.validate();
60      }
61      //Center the window
62      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
63      Dimension frameSize = frame.getSize();
64      if (frameSize.height > screenSize.height) {
65        frameSize.height = screenSize.height;
66      }
67      if (frameSize.width > screenSize.width) {
68        frameSize.width = screenSize.width;
69      }
70      frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
71      frame.setVisible(true);
72    }
73  
74    /***
75     * Starts the GUI.
76     * @param args Arguments are not evaluated.
77     */
78    public static void main(String[] args) {
79      try {
80        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
81      }
82      catch(Exception e) {
83        e.printStackTrace();
84      }
85      new MatchingGUI();
86    }
87  }