1 18 19 20 package sync4j.syncclient.spds; 21 22 import java.awt.*; 23 import java.awt.event.*; 24 import javax.swing.*; 25 import javax.swing.event.*; 26 import javax.swing.border.*; 27 28 35 public class UpdateProgressBar extends Dialog { 36 37 39 private static int WIDTH = 240; 40 private static int HEIGHT = 80; 41 42 44 private Dimension dim = null; 45 46 private JPanel barPanel = new JPanel(); 47 private JProgressBar progressBar = new JProgressBar(); 48 private JLabel labelProgressBar = new JLabel(); 49 50 52 53 public UpdateProgressBar(Frame parent, int maximum, String applicationName) { 54 55 super(parent); 56 57 labelProgressBar = new JLabel(); 58 59 progressBar.setOrientation(JProgressBar.HORIZONTAL); 60 61 progressBar.setMinimum(0); 62 progressBar.setMaximum(maximum); 63 64 barPanel.add(labelProgressBar); 65 barPanel.add(progressBar); 66 67 this.add("Center",barPanel); 68 this.setSize(WIDTH,HEIGHT); 69 dim = getToolkit().getScreenSize(); 70 this.setLocation(dim.width/2 - getWidth()/2, dim.height/2 - getHeight()/2); 71 this.setBackground(Color.darkGray); 72 this.setTitle(applicationName); 73 74 } 75 76 78 public void setValue(int value) { 79 progressBar.setValue(value); 80 } 81 82 public void close(int value) { 83 this.setVisible(false); 84 85 } 86 87 public void Display(String dataStoreName) { 88 89 if (dataStoreName.length() < 6) { 91 dataStoreName = dataStoreName + " "; 92 } 93 94 this.labelProgressBar.setText("Update: " + dataStoreName); 95 96 this.show(); 97 98 } 99 100 101 } | Popular Tags |