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