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