KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > projectimport > eclipse > 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.projectimport.eclipse.wizard;
21
22 import java.awt.Dimension JavaDoc;
23 import java.awt.GridBagConstraints JavaDoc;
24 import java.awt.GridBagLayout JavaDoc;
25 import java.awt.Insets JavaDoc;
26 import javax.swing.JComponent JavaDoc;
27 import javax.swing.JPanel JavaDoc;
28 import org.netbeans.api.progress.ProgressHandle;
29 import org.netbeans.api.progress.ProgressHandleFactory;
30 import org.netbeans.modules.projectimport.eclipse.ImportProjectAction;
31 import org.openide.util.NbBundle;
32
33 /**
34  * Shows status(progress) of importing.
35  *
36  * @author mkrauskopf
37  */

38 public final class ProgressPanel extends JPanel JavaDoc {
39     
40     private JComponent JavaDoc progress;
41     private ProgressHandle handle;
42     
43     /** Creates new form ProgressPanel */
44     public ProgressPanel() {
45         initComponents();
46         handle = ProgressHandleFactory.createHandle(
47                 NbBundle.getMessage(ImportProjectAction.class, "CTL_ProgressDialogTitle"));
48         progress = ProgressHandleFactory.createProgressComponent(handle);
49         setLayout(new GridBagLayout JavaDoc());
50         setPreferredSize(new Dimension JavaDoc(450, 80));
51         GridBagConstraints JavaDoc gridBagConstraints = new GridBagConstraints JavaDoc();
52         gridBagConstraints.gridx = 0;
53         gridBagConstraints.gridy = 0;
54         gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
55         gridBagConstraints.weightx = 1.0;
56         gridBagConstraints.insets = new Insets JavaDoc(0, 5, 0, 5);
57         add(progress, gridBagConstraints);
58     }
59     
60     public void start(final int n) {
61         handle.start(n);
62     }
63     
64     public void setProgress(final int current, final String JavaDoc info) {
65         handle.progress(info, current);
66     }
67     
68     /** This method is called from within the constructor to
69      * initialize the form.
70      * WARNING: Do NOT modify this code. The content of this method is
71      * always regenerated by the Form Editor.
72      */

73     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
74
private void initComponents() {
75         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
76
77         setLayout(new java.awt.GridBagLayout JavaDoc());
78
79         setPreferredSize(new java.awt.Dimension JavaDoc(450, 80));
80     }
81     // </editor-fold>//GEN-END:initComponents
82

83     
84     // Variables declaration - do not modify//GEN-BEGIN:variables
85
// End of variables declaration//GEN-END:variables
86

87 }
88
Popular Tags