Skip to content

Commit 1ae97df

Browse files
committed
hi-dpi handling for SDK download dialog
1 parent 9c21632 commit 1ae97df

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/processing/mode/android/SDKDownloader.java

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050

5151
@SuppressWarnings("serial")
5252
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+
5359
private static final int PLATFORM_TOOLS = 2;
5460
private static final int ANDROID_REPO = 4;
5561
private static final int GOOGLE_REPO = 5;
@@ -486,26 +492,33 @@ private void createLayout() {
486492
Container outer = getContentPane();
487493
outer.removeAll();
488494

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);
492498

493499
String labelText = "Downloading Android SDK...";
494500
JLabel textarea = new JLabel(labelText);
495501
textarea.setAlignmentX(LEFT_ALIGNMENT);
496-
pain.add(textarea);
502+
vbox.add(textarea);
497503

504+
JPanel progressPanel = new JPanel();
498505
progressBar = new JProgressBar(0, 100);
506+
// progressBar.setPreferredSize(new Dimension(BAR_WIDTH, BAR_HEIGHT));
507+
progressBar.setPreferredSize(new Dimension(BAR_WIDTH, BAR_HEIGHT));
499508
progressBar.setValue(0);
500509
progressBar.setStringPainted(true);
501510
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);
504515

505-
downloadedTextArea = new JLabel("");
516+
downloadedTextArea = new JLabel("0 / 0 MB");
506517
downloadedTextArea.setAlignmentX(LEFT_ALIGNMENT);
507-
pain.add(downloadedTextArea);
518+
vbox.add(downloadedTextArea);
508519

520+
vbox.add(Box.createVerticalStrut(GAP));
521+
509522
// buttons
510523
JPanel buttons = new JPanel();
511524
// buttons.setPreferredSize(new Dimension(400, 35));
@@ -525,7 +538,7 @@ private void createLayout() {
525538
buttons.setAlignmentX(LEFT_ALIGNMENT);
526539
JButton cancelButton = new JButton("Cancel download");
527540
Dimension dim = new Dimension(Toolkit.getButtonWidth()*2,
528-
cancelButton.getPreferredSize().height);
541+
Toolkit.zoom(cancelButton.getPreferredSize().height));
529542

530543
cancelButton.setPreferredSize(dim);
531544
cancelButton.addActionListener(new ActionListener() {
@@ -541,7 +554,7 @@ public void actionPerformed(ActionEvent e) {
541554

542555
buttons.add(cancelButton);
543556
// buttons.setMaximumSize(new Dimension(300, buttons.getPreferredSize().height));
544-
pain.add(buttons);
557+
vbox.add(buttons);
545558

546559
JRootPane root = getRootPane();
547560
root.setDefaultButton(cancelButton);

0 commit comments

Comments
 (0)