1 19 20 package org.netbeans.modules.projectimport.eclipse.wizard; 21 22 import java.awt.Dimension ; 23 import java.awt.GridBagConstraints ; 24 import java.awt.GridBagLayout ; 25 import java.awt.Insets ; 26 import javax.swing.JComponent ; 27 import javax.swing.JPanel ; 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 38 public final class ProgressPanel extends JPanel { 39 40 private JComponent progress; 41 private ProgressHandle handle; 42 43 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 ()); 50 setPreferredSize(new Dimension (450, 80)); 51 GridBagConstraints gridBagConstraints = new GridBagConstraints (); 52 gridBagConstraints.gridx = 0; 53 gridBagConstraints.gridy = 0; 54 gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; 55 gridBagConstraints.weightx = 1.0; 56 gridBagConstraints.insets = new Insets (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 info) { 65 handle.progress(info, current); 66 } 67 68 73 private void initComponents() { 75 java.awt.GridBagConstraints gridBagConstraints; 76 77 setLayout(new java.awt.GridBagLayout ()); 78 79 setPreferredSize(new java.awt.Dimension (450, 80)); 80 } 81 83 84 87 } 88 | Popular Tags |