KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > monitor > client > ProgressMonitor


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.monitor.client;
21
22 import javax.swing.SwingUtilities JavaDoc;
23
24 import org.openide.util.NbBundle;
25 import org.openide.util.Utilities;
26 import org.openide.windows.WindowManager;
27
28 /**
29  * Progress monitor dialog box.
30  *
31  * @author Stepan Herold
32  */

33 public class ProgressMonitor extends javax.swing.JDialog JavaDoc {
34
35
36     /**
37      * Create new ProgressMonitor.
38      */

39     public ProgressMonitor() {
40         super(WindowManager.getDefault().getMainWindow(), true);
41         setModal(true);
42         initComponents();
43         setBounds(Utilities.findCenterBounds(getSize()));
44         setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
45         setTitle(NbBundle.getMessage(ProgressMonitor.class, "LBL_Delete_Progress_Monitor"));
46     }
47     
48     /**
49      * Close progress monitor dialog box.
50      */

51     public void close() {
52         progressBar.setValue(progressBar.getMaximum());
53         setVisible(false);
54         dispose();
55     }
56
57     /**
58      * Set progress bar value.
59      *
60      * @param value new progress bar value from range 0 - 100.
61      */

62     public void setValue(int value) {
63         progressBar.setValue(value);
64     }
65     
66     /** This method is called from within the constructor to
67      * initialize the form.
68      * WARNING: Do NOT modify this code. The content of this method is
69      * always regenerated by the Form Editor.
70      */

71     private void initComponents() {//GEN-BEGIN:initComponents
72
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
73
74         progressBar = new javax.swing.JProgressBar JavaDoc();
75         label = new javax.swing.JLabel JavaDoc();
76         note = new javax.swing.JLabel JavaDoc();
77
78         getContentPane().setLayout(new java.awt.GridBagLayout JavaDoc());
79
80         setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
81         setResizable(false);
82         progressBar.setMinimumSize(new java.awt.Dimension JavaDoc(148, 14));
83         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
84         gridBagConstraints.gridx = 1;
85         gridBagConstraints.gridy = 1;
86         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
87         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 5, 0, 5);
88         getContentPane().add(progressBar, gridBagConstraints);
89
90         label.setText(NbBundle.getMessage (ProgressMonitor.class, "MSG_Delete_Progress_Monitor"));
91         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
92         gridBagConstraints.gridx = 1;
93         gridBagConstraints.gridy = 0;
94         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
95         gridBagConstraints.insets = new java.awt.Insets JavaDoc(10, 5, 10, 5);
96         getContentPane().add(label, gridBagConstraints);
97
98         note.setFont(new java.awt.Font JavaDoc("Dialog", 0, 12));
99         note.setText(NbBundle.getMessage (ProgressMonitor.class, "MSG_Delete_Progress_Monitor_note"));
100         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.gridx = 1;
102         gridBagConstraints.gridy = 2;
103         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
104         gridBagConstraints.insets = new java.awt.Insets JavaDoc(4, 5, 5, 5);
105         getContentPane().add(note, gridBagConstraints);
106
107         pack();
108     }//GEN-END:initComponents
109

110     // Variables declaration - do not modify//GEN-BEGIN:variables
111
private javax.swing.JLabel JavaDoc label;
112     private javax.swing.JLabel JavaDoc note;
113     private javax.swing.JProgressBar JavaDoc progressBar;
114     // End of variables declaration//GEN-END:variables
115

116 }
117
Popular Tags