01: /*
02: * Copyright 2000-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: /** Constructor. */
35: public GraphicalVerifier() {
36: VerifierAppFrame frame = new VerifierAppFrame();
37: //Frames überprüfen, die voreingestellte Größe haben
38: //Frames packen, die nutzbare bevorzugte Größeninformationen enthalten, z.B. aus ihrem Layout
39: if (packFrame) {
40: frame.pack();
41: } else {
42: frame.validate();
43: }
44: //Das Fenster zentrieren
45: Dimension screenSize = Toolkit.getDefaultToolkit()
46: .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: /** Main method. */
63: public static void main(String[] args) {
64: try {
65: UIManager.setLookAndFeel(UIManager
66: .getSystemLookAndFeelClassName());
67: } catch (Exception e) {
68: e.printStackTrace();
69: }
70: new GraphicalVerifier();
71: }
72: }
|