KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > dbschema > jdbcimpl > wizard > ProgressPanel


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.dbschema.jdbcimpl.wizard;
21
22 import java.awt.BorderLayout JavaDoc;
23 import java.awt.Dialog JavaDoc;
24 import java.awt.Dimension JavaDoc;
25 import javax.swing.JComponent JavaDoc;
26 import javax.swing.JDialog JavaDoc;
27 import org.openide.DialogDescriptor;
28 import org.openide.DialogDisplayer;
29 import org.openide.util.NbBundle;
30
31 /**
32  *
33  * @author Martin Adamek, Andrei Badea
34  */

35 public class ProgressPanel extends javax.swing.JPanel JavaDoc {
36
37     private Dialog JavaDoc dialog;
38
39     /** Creates new form ProgressPanel */
40     public ProgressPanel() {
41         initComponents();
42     }
43
44     public void open(JComponent JavaDoc progressComponent) {
45         holder.add(progressComponent, BorderLayout.CENTER);
46         DialogDescriptor dd = new DialogDescriptor(
47                 this,
48                 NbBundle.getMessage(ProgressPanel.class, "MSG_PleaseWait"),
49                 true,
50                 new Object JavaDoc[0],
51                 DialogDescriptor.NO_OPTION,
52                 DialogDescriptor.DEFAULT_ALIGN,
53                 null,
54                 null
55                 );
56         dialog = DialogDisplayer.getDefault().createDialog(dd);
57         if (dialog instanceof JDialog JavaDoc) {
58             ((JDialog JavaDoc)dialog).setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
59         }
60         dialog.setResizable(false);
61         dialog.setVisible(true);
62     }
63     
64     public void close() {
65     if (dialog != null) {
66         dialog.setVisible(false);
67         dialog.dispose();
68     }
69     }
70     
71     public void setText(String JavaDoc text) {
72         info.setText(text);
73     }
74     
75     /** This method is called from within the constructor to
76      * initialize the form.
77      * WARNING: Do NOT modify this code. The content of this method is
78      * always regenerated by the Form Editor.
79      */

80     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
81
private void initComponents() {
82         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
83
84         info = new javax.swing.JLabel JavaDoc();
85         holder = new javax.swing.JPanel JavaDoc();
86
87         setLayout(new java.awt.GridBagLayout JavaDoc());
88
89         info.setText(" ");
90         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
91         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
92         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 11, 11);
93         add(info, gridBagConstraints);
94
95         holder.setLayout(new java.awt.BorderLayout JavaDoc());
96
97         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
98         gridBagConstraints.gridx = 0;
99         gridBagConstraints.gridy = 1;
100         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
101         gridBagConstraints.weightx = 1.0;
102         gridBagConstraints.weighty = 1.0;
103         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 11, 11);
104         add(holder, gridBagConstraints);
105
106     }// </editor-fold>//GEN-END:initComponents
107

108     
109     // Variables declaration - do not modify//GEN-BEGIN:variables
110
private javax.swing.JPanel JavaDoc holder;
111     private javax.swing.JLabel JavaDoc info;
112     // End of variables declaration//GEN-END:variables
113

114     public Dimension JavaDoc getPreferredSize() {
115         Dimension JavaDoc orig = super.getPreferredSize();
116         return new Dimension JavaDoc(500, orig.height);
117     }
118     
119 }
120
Popular Tags