GraphicalVerifier xref

View Javadoc

    1   /*
    2    * Copyright  2000-2004 The Apache Software Foundation
    3    *
    4    *  Licensed under the Apache License, Version 2.0 (the "License");
    5    *  you may not use this file except in compliance with the License.
    6    *  You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   *  Unless required by applicable law or agreed to in writing, software
    11   *  distributed under the License is distributed on an "AS IS" BASIS,
    12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   *  See the License for the specific language governing permissions and
    14   *  limitations under the License.
    15   *
    16   */
    17  package org.apache.bcel.verifier;
    18
    19  import java.awt.Dimension;
    20  import java.awt.Toolkit;
    21  import javax.swing.UIManager;
    22  import org.apache.bcel.generic.Type;
    23
    24  /***
    25   * A graphical user interface application demonstrating JustIce.
    26   *
    27   * @version $Id: GraphicalVerifier.java 386056 2006-03-15 11:31:56Z tcurdt $
    28   * @author Enver Haase
    29   */
    30  public class GraphicalVerifier {
    31
    32      boolean packFrame = false;
    33
    34
    35      /*** Constructor. */
    36      public GraphicalVerifier() {
    37          VerifierAppFrame frame = new VerifierAppFrame();
    38          //Frames ¸berpr¸fen, die voreingestellte Gr??e haben
    39          //Frames packen, die nutzbare bevorzugte Gr??eninformationen enthalten, z.B. aus ihrem Layout
    40          if (packFrame) {
    41              frame.pack();
    42          } else {
    43              frame.validate();
    44          }
    45          //Das Fenster zentrieren
    46          Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    47          Dimension frameSize = frame.getSize();
    48          if (frameSize.height > screenSize.height) {
    49              frameSize.height = screenSize.height;
    50          }
    51          if (frameSize.width > screenSize.width) {
    52              frameSize.width = screenSize.width;
    53          }
    54          frame.setLocation((screenSize.width - frameSize.width) / 2,
    55                  (screenSize.height - frameSize.height) / 2);
    56          frame.setVisible(true);
    57          frame.classNamesJList.setModel(new VerifierFactoryListModel());
    58          VerifierFactory.getVerifier(Type.OBJECT.getClassName()); // Fill list with java.lang.Object
    59          frame.classNamesJList.setSelectedIndex(0); // default, will verify java.lang.Object
    60      }
    61
    62
    63      /*** Main method. */
    64      public static void main( String[] args ) {
    65          try {
    66              UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    67          } catch (Exception e) {
    68              e.printStackTrace();
    69          }
    70          new GraphicalVerifier();
    71      }
    72  }