50
50
51
51
@ SuppressWarnings ("serial" )
52
52
public class SDKDownloader extends JDialog implements PropertyChangeListener {
53
+ final static private int BOX_BORDER = Toolkit .zoom (13 );
54
+ final static private int BAR_BORDER = Toolkit .zoom (10 );
55
+ final static private int BAR_WIDTH = Toolkit .zoom (300 );
56
+ final static private int BAR_HEIGHT = Toolkit .zoom (15 );
57
+ final static private int GAP = Toolkit .zoom (13 );
58
+
53
59
private static final int PLATFORM_TOOLS = 2 ;
54
60
private static final int ANDROID_REPO = 4 ;
55
61
private static final int GOOGLE_REPO = 5 ;
@@ -486,26 +492,33 @@ private void createLayout() {
486
492
Container outer = getContentPane ();
487
493
outer .removeAll ();
488
494
489
- Box pain = Box .createVerticalBox ();
490
- pain .setBorder (new EmptyBorder (13 , 13 , 13 , 13 ));
491
- outer .add (pain );
495
+ Box vbox = Box .createVerticalBox ();
496
+ vbox .setBorder (new EmptyBorder (BOX_BORDER , BOX_BORDER , BOX_BORDER , BOX_BORDER ));
497
+ outer .add (vbox );
492
498
493
499
String labelText = "Downloading Android SDK..." ;
494
500
JLabel textarea = new JLabel (labelText );
495
501
textarea .setAlignmentX (LEFT_ALIGNMENT );
496
- pain .add (textarea );
502
+ vbox .add (textarea );
497
503
504
+ JPanel progressPanel = new JPanel ();
498
505
progressBar = new JProgressBar (0 , 100 );
506
+ // progressBar.setPreferredSize(new Dimension(BAR_WIDTH, BAR_HEIGHT));
507
+ progressBar .setPreferredSize (new Dimension (BAR_WIDTH , BAR_HEIGHT ));
499
508
progressBar .setValue (0 );
500
509
progressBar .setStringPainted (true );
501
510
progressBar .setIndeterminate (true );
502
- progressBar .setBorder (new EmptyBorder (10 , 10 , 10 , 10 ) );
503
- pain .add (progressBar );
511
+ progressBar .setBorder (new EmptyBorder (BAR_BORDER , BAR_BORDER , BAR_BORDER , BAR_BORDER ));
512
+ progressPanel .add (progressBar );
513
+ // vbox.add(progressBar);
514
+ vbox .add (progressPanel );
504
515
505
- downloadedTextArea = new JLabel ("" );
516
+ downloadedTextArea = new JLabel ("0 / 0 MB " );
506
517
downloadedTextArea .setAlignmentX (LEFT_ALIGNMENT );
507
- pain .add (downloadedTextArea );
518
+ vbox .add (downloadedTextArea );
508
519
520
+ vbox .add (Box .createVerticalStrut (GAP ));
521
+
509
522
// buttons
510
523
JPanel buttons = new JPanel ();
511
524
// buttons.setPreferredSize(new Dimension(400, 35));
@@ -525,7 +538,7 @@ private void createLayout() {
525
538
buttons .setAlignmentX (LEFT_ALIGNMENT );
526
539
JButton cancelButton = new JButton ("Cancel download" );
527
540
Dimension dim = new Dimension (Toolkit .getButtonWidth ()*2 ,
528
- cancelButton .getPreferredSize ().height );
541
+ Toolkit . zoom ( cancelButton .getPreferredSize ().height ) );
529
542
530
543
cancelButton .setPreferredSize (dim );
531
544
cancelButton .addActionListener (new ActionListener () {
@@ -541,7 +554,7 @@ public void actionPerformed(ActionEvent e) {
541
554
542
555
buttons .add (cancelButton );
543
556
// buttons.setMaximumSize(new Dimension(300, buttons.getPreferredSize().height));
544
- pain .add (buttons );
557
+ vbox .add (buttons );
545
558
546
559
JRootPane root = getRootPane ();
547
560
root .setDefaultButton (cancelButton );
0 commit comments