001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 * 017 */ 018package org.apache.bcel.verifier; 019 020import java.awt.Dimension; 021import java.awt.Toolkit; 022import javax.swing.UIManager; 023 024import org.apache.bcel.generic.Type; 025 026/** 027 * A graphical user interface application demonstrating JustIce. 028 * 029 * @version $Id: GraphicalVerifier.java 1749603 2016-06-21 20:50:19Z ggregory $ 030 */ 031public class GraphicalVerifier { 032 033 private final boolean packFrame = false; 034 035 036 /** Constructor. */ 037 public GraphicalVerifier() { 038 final VerifierAppFrame frame = new VerifierAppFrame(); 039 //Frames �berpr�fen, die voreingestellte Gr��e haben 040 //Frames packen, die nutzbare bevorzugte Gr��eninformationen enthalten, z.B. aus ihrem Layout 041 if (packFrame) { 042 frame.pack(); 043 } else { 044 frame.validate(); 045 } 046 //Das Fenster zentrieren 047 final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 048 final Dimension frameSize = frame.getSize(); 049 if (frameSize.height > screenSize.height) { 050 frameSize.height = screenSize.height; 051 } 052 if (frameSize.width > screenSize.width) { 053 frameSize.width = screenSize.width; 054 } 055 frame.setLocation((screenSize.width - frameSize.width) / 2, 056 (screenSize.height - frameSize.height) / 2); 057 frame.setVisible(true); 058 frame.getClassNamesJList().setModel(new VerifierFactoryListModel()); 059 VerifierFactory.getVerifier(Type.OBJECT.getClassName()); // Fill list with java.lang.Object 060 frame.getClassNamesJList().setSelectedIndex(0); // default, will verify java.lang.Object 061 } 062 063 064 /** Main method. */ 065 public static void main( final String[] args ) { 066 try { 067 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 068 } catch (final Exception e) { 069 e.printStackTrace(); 070 } 071 new GraphicalVerifier(); 072 } 073}