01: /**
02: * LibreSource
03: * Copyright (C) 2004-2008 Artenum SARL / INRIA
04: * http://www.libresource.org - contact@artenum.com
05: *
06: * This file is part of the LibreSource software,
07: * which can be used and distributed under license conditions.
08: * The license conditions are provided in the LICENSE.TXT file
09: * at the root path of the packaging that enclose this file.
10: * More information can be found at
11: * - http://dev.libresource.org/home/license
12: *
13: * Initial authors :
14: *
15: * Guillaume Bort / INRIA
16: * Francois Charoy / Universite Nancy 2
17: * Julien Forest / Artenum
18: * Claude Godart / Universite Henry Poincare
19: * Florent Jouille / INRIA
20: * Sebastien Jourdain / INRIA / Artenum
21: * Yves Lerumeur / Artenum
22: * Pascal Molli / Universite Henry Poincare
23: * Gerald Oster / INRIA
24: * Mariarosa Penzi / Artenum
25: * Gerard Sookahet / Artenum
26: * Raphael Tani / INRIA
27: *
28: * Contributors :
29: *
30: * Stephane Bagnier / Artenum
31: * Amadou Dia / Artenum-IUP Blois
32: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33: */package org.libresource.so6.adapter.ls.tools;
34:
35: import java.awt.BorderLayout;
36: import java.awt.Color;
37: import java.awt.GridLayout;
38: import java.awt.Toolkit;
39: import java.awt.event.WindowAdapter;
40: import java.awt.event.WindowEvent;
41:
42: import javax.swing.BorderFactory;
43: import javax.swing.JDialog;
44: import javax.swing.JLabel;
45: import javax.swing.JPanel;
46: import javax.swing.JProgressBar;
47:
48: /**
49: * @author smack
50: */
51: public class IndeterminateProgressView extends JDialog {
52: public IndeterminateProgressView(String title, String message) {
53: super ();
54: setTitle(title);
55:
56: JProgressBar bar = new JProgressBar();
57: bar.setIndeterminate(true);
58:
59: JLabel messageLabel = new JLabel(message);
60: messageLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5,
61: 5));
62:
63: JPanel barPanel = new JPanel(new BorderLayout());
64: barPanel.add(bar, BorderLayout.CENTER);
65: barPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
66: barPanel.setBackground(Color.WHITE);
67: getContentPane().setBackground(Color.WHITE);
68: getContentPane().setLayout(new GridLayout(2, 0));
69: getContentPane().add(messageLabel);
70: getContentPane().add(barPanel);
71: pack();
72: setLocation(((int) Toolkit.getDefaultToolkit().getScreenSize()
73: .getWidth() - getWidth()) / 2,
74: ((int) Toolkit.getDefaultToolkit().getScreenSize()
75: .getHeight() - getHeight()) / 2);
76: setResizable(false);
77:
78: setVisible(true);
79: }
80:
81: public static void main(String[] args) {
82: new IndeterminateProgressView("Test",
83: "Please wait during the download and the patch application...")
84: .addWindowListener(new WindowAdapter() {
85: public void windowClosing(WindowEvent e) {
86: System.exit(0);
87: }
88: });
89: }
90: }
|