source: ether_statistics/service/implementation/gov/noaa/pmel/sgt/demo/BeanDemo.java @ 569

Last change on this file since 569 was 569, checked in by vmipsl, 12 years ago

Nouveau projet

File size: 2.0 KB
Line 
1/*
2 * $Id: BeanDemo.java,v 1.2 2003/08/22 23:02:38 dwd Exp $
3 *
4 * This software is provided by NOAA for full, free and open release.  It is
5 * understood by the recipient/user that NOAA assumes no liability for any
6 * errors contained in the code.  Although this software is released without
7 * conditions or restrictions in its use, it is expected that appropriate
8 * credit be given to its author and to the National Oceanic and Atmospheric
9 * Administration should the software be included by the recipient as an
10 * element in other product development.
11 */
12package gov.noaa.pmel.sgt.demo;
13
14import javax.swing.UIManager;
15import java.awt.*;
16
17/**
18 * Example demonstrating the use of the SGT Bean classes.  This application
19 * looks for the BeanDemoPanelModel.xml file in the same directory as
20 * gov.noaa.pmel.sgt.beans.
21 *
22 * @author Donald Denbo
23 * @version $Revision: 1.2 $, $Date: 2003/08/22 23:02:38 $
24 * @since 3.0
25 **/
26public class BeanDemo {
27  private boolean packFrame = false;
28
29  //Construct the application
30  public BeanDemo() {
31    BeanDemoFrame frame = new BeanDemoFrame();
32    //Validate frames that have preset sizes
33    //Pack frames that have useful preferred size info, e.g. from their layout
34    if (packFrame) {
35      frame.pack();
36    }
37    else {
38      frame.validate();
39    }
40    //Center the window
41    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
42    Dimension frameSize = frame.getSize();
43    if (frameSize.height > screenSize.height) {
44      frameSize.height = screenSize.height;
45    }
46    if (frameSize.width > screenSize.width) {
47      frameSize.width = screenSize.width;
48    }
49    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
50    frame.setVisible(true);
51  }
52  //Main method
53  public static void main(String[] args) {
54    try {
55      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
56    }
57    catch(Exception e) {
58      e.printStackTrace();
59    }
60    new BeanDemo();
61  }
62}
Note: See TracBrowser for help on using the repository browser.