KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > debugger > gui > StartupScreen


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the debugger and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  */

22 package org.aspectj.debugger.gui;
23
24 import org.aspectj.util.gui.*;
25
26 import java.awt.*;
27 import java.awt.event.*;
28 import javax.swing.*;
29 import javax.swing.border.*;
30
31 public class StartupScreen extends org.aspectj.util.gui.CenteredJFrame {
32
33     public static void main(String JavaDoc[] args) {
34         final StartupScreen ss = new StartupScreen();
35         ss.pack();
36         ss.setVisible(true);
37
38         Thread JavaDoc thread = new Thread JavaDoc() {
39             int i = 0;
40             boolean running = true;
41             public void run() {
42                 while (true) {
43                     try {
44                         if (i == 10) {
45                             ss.setVisible(false);
46                             ss.dispose();
47                             running = false;
48                         }
49                         ss.setProgress((i++) + "");
50                         Thread.sleep(1000);
51                     } catch (Exception JavaDoc e) {
52
53                     }
54                 }
55             }
56         };
57         thread.run();
58     }
59
60     final String JavaDoc imageName = "C:\\src\\aspectj.gif";
61     JLabel progress;
62
63     public StartupScreen() {
64         super("Starting AJDB...");
65
66         JPanel panel = new JPanel();
67         panel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
68         panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
69         ImageIcon image = new ImageIcon(imageName);
70         panel.add(new JLabel(image));
71
72         progress = new JLabel();
73         setProgress("Progress...");
74         panel.add(progress);
75
76         getContentPane().add(panel);
77
78         addWindowListener(new WindowAdapter() {
79             public void windowClosing(WindowEvent e) {
80                 System.exit(0);
81             }
82         });
83     }
84
85     public void setProgress(String JavaDoc str) {
86         progress.setText(str);
87     }
88 }
Popular Tags