Skip to content

Commit e301080

Browse files
committed
TEST: scale UI buttons based on theme scaling preferences
1 parent 4def517 commit e301080

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/cc/arduino/plugins/wifi101/UpdaterJFrame.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
import cc.arduino.plugins.wifi101.flashers.Flasher;
5454
import processing.app.Base;
55+
import processing.app.Theme;
5556

5657
@SuppressWarnings("serial")
5758
public class UpdaterJFrame extends JFrame {
@@ -89,10 +90,12 @@ public void run() {
8990
}
9091

9192
public UpdaterJFrame() {
93+
94+
int scale = Theme.getScale();
9295
setTitle("WiFi101 / WiFiNINA Firmware/Certificates Updater");
9396
setResizable(false);
9497
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
95-
setBounds(100, 100, 500, 520);
98+
setBounds(100 * scale / 100, 100 * scale / 100, 500 * scale / 100, 520 * scale / 100);
9699
contentPane = new JPanel();
97100
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
98101
setContentPane(contentPane);
@@ -105,8 +108,8 @@ public UpdaterJFrame() {
105108

106109
panel_1 = new JPanel();
107110
panel_1.setBorder(new TitledBorder(null, "1. Select port of the WiFi module", TitledBorder.LEADING, TitledBorder.TOP, null, null));
108-
panel_1.setMinimumSize(new Dimension(500, 150));
109-
panel_1.setPreferredSize(new Dimension(500, 150));
111+
panel_1.setMinimumSize(new Dimension(500 * scale / 100, 150 * scale / 100));
112+
panel_1.setPreferredSize(new Dimension(500 * scale / 100, 150 * scale / 100));
110113
GridBagConstraints gbc_panel_1 = new GridBagConstraints();
111114
gbc_panel_1.insets = new Insets(5, 5, 0, 5);
112115
gbc_panel_1.fill = GridBagConstraints.BOTH;
@@ -132,7 +135,7 @@ public UpdaterJFrame() {
132135

133136
serialPortList = new JList<String>();
134137
JScrollPane sp = new JScrollPane(serialPortList);
135-
serialPortList.setMaximumSize(new Dimension(300, 100));
138+
serialPortList.setMaximumSize(new Dimension(300 * scale / 100, 100 * scale / 100));
136139
GridBagConstraints gbc_serialPortList = new GridBagConstraints();
137140
gbc_serialPortList.insets = new Insets(5, 5, 5, 5);
138141
gbc_serialPortList.fill = GridBagConstraints.BOTH;
@@ -188,7 +191,7 @@ public void actionPerformed(ActionEvent e) {
188191

189192
panel = new JPanel();
190193
panel.setBorder(new TitledBorder(new LineBorder(new Color(184, 207, 229)), "2. Update firmware", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(51, 51, 51)));
191-
panel.setMinimumSize(new Dimension(500, 150));
194+
panel.setMinimumSize(new Dimension(500 * scale / 100, 150 * scale / 100));
192195
GridBagConstraints gbc_panel = new GridBagConstraints();
193196
gbc_panel.insets = new Insets(5, 5, 0, 5);
194197
gbc_panel.fill = GridBagConstraints.BOTH;
@@ -240,7 +243,7 @@ public void actionPerformed(ActionEvent e) {
240243

241244
panel_2 = new JPanel();
242245
panel_2.setBorder(new TitledBorder(null, "3. Update SSL root certificates", TitledBorder.LEFT, TitledBorder.TOP, null, null));
243-
panel_2.setMinimumSize(new Dimension(500, 200));
246+
panel_2.setMinimumSize(new Dimension(500 * scale / 100, 200 * scale / 100));
244247
GridBagConstraints gbc_panel_2 = new GridBagConstraints();
245248
gbc_panel_2.insets = new Insets(5, 5, 0, 5);
246249
gbc_panel_2.fill = GridBagConstraints.BOTH;
@@ -268,7 +271,7 @@ public void actionPerformed(ActionEvent e) {
268271
textFwNot= new JLabel();
269272
textFwNot.setText("No certificates available");
270273
textFwNot.setOpaque(false);
271-
textFwNot.setMinimumSize(new Dimension(500,500));
274+
textFwNot.setMinimumSize(new Dimension(500 * scale / 100, 500 * scale / 100));
272275
GridBagConstraints gbc_textFwNot = new GridBagConstraints();
273276
gbc_textFwNot.gridwidth = 2;
274277
gbc_textFwNot.insets = new Insets(5, 5, 5, 0);

0 commit comments

Comments
 (0)