Repository: zaproxy/zaproxy
Issue: Break panel icons do not resize

```
I'd rather open it up for comment to see if anyone else agrees first. 

One: If you're continually using them, you'd want something big you can easily click.
There's a bit of precision clicking going or a little extra care which is required
if you're clicking constantly at a high rate.

As a bonus, i've seen quite a few people starting off with zap miss them completely
because of their size and not know how to intercept. While yes, rtfm, ui that allows
you to easily infer how to use it is a good thing.

I do think burp got the right scale + having names on this one. What do people think
comparing the two?
```

Original issue reported on code.google.com by `contact@markcunningham.ie` on 2013-02-27 09:59:47


Changed files:
zap/src/main/java/org/parosproxy/paros/view/AbstractParamContainerPanel.java
zap/src/main/java/org/parosproxy/paros/view/OptionsDialog.java
zap/src/main/java/org/zaproxy/zap/extension/brk/BreakPanelToolbarFactory.java
zap/src/main/java/org/parosproxy/paros/extension/manualrequest/ManualRequestEditorDialog.java
zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyDialog.java
zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyManagerDialog.java
zap/src/main/java/org/zaproxy/zap/view/AboutPanel.java

diff --git a/zap/src/main/java/org/parosproxy/paros/extension/manualrequest/ManualRequestEditorDialog.java b/zap/src/main/java/org/parosproxy/paros/extension/manualrequest/ManualRequestEditorDialog.java
index 5e12593de..b391b8632 100644
--- a/zap/src/main/java/org/parosproxy/paros/extension/manualrequest/ManualRequestEditorDialog.java
+++ b/zap/src/main/java/org/parosproxy/paros/extension/manualrequest/ManualRequestEditorDialog.java
@@ -41,11 +41,11 @@
 // ZAP: 2020/11/20 Support Send button in response panel in tab mode
 // ZAP: 2020/11/26 Use Log4j 2 classes for logging.
 // ZAP: 2021/02/12 Add shortcut key to Send button (Issue 6448).
+// ZAP: 2022/06/08 Fix resizing issues.
 package org.parosproxy.paros.extension.manualrequest;
 
 import java.awt.BorderLayout;
 import java.awt.Component;
-import java.awt.Dimension;
 import java.awt.EventQueue;
 import java.awt.HeadlessException;
 import java.awt.event.KeyEvent;
@@ -68,6 +68,7 @@ import org.zaproxy.zap.extension.httppanel.HttpPanelRequest;
 import org.zaproxy.zap.extension.httppanel.InvalidMessageDataException;
 import org.zaproxy.zap.extension.httppanel.Message;
 import org.zaproxy.zap.extension.tab.Tab;
+import org.zaproxy.zap.utils.DisplayUtils;
 import org.zaproxy.zap.view.ZapMenuItem;
 
 /** Send custom crafted messages via HTTP or other TCP based protocols. */
@@ -100,7 +101,7 @@ public abstract class ManualRequestEditorDialog extends AbstractFrame implements
         this.isSendEnabled = isSendEnabled;
         this.configurationKey = OptionsParamView.BASE_VIEW_KEY + "." + configurationKey + ".";
 
-        this.setPreferredSize(new Dimension(700, 800));
+        this.setPreferredSize(DisplayUtils.getScaledDimension(700, 800));
     }
 
     protected void initialize() {
diff --git a/zap/src/main/java/org/parosproxy/paros/view/AbstractParamContainerPanel.java b/zap/src/main/java/org/parosproxy/paros/view/AbstractParamContainerPanel.java
index 57b9c36a4..3a573b359 100644
--- a/zap/src/main/java/org/parosproxy/paros/view/AbstractParamContainerPanel.java
+++ b/zap/src/main/java/org/parosproxy/paros/view/AbstractParamContainerPanel.java
@@ -39,6 +39,7 @@
 // ZAP: 2021/11/19 Remove empty parent nodes.
 // ZAP: 2022/02/12 Show child panel if parent has none.
 // ZAP: 2022/05/11 Use a unique ID to identify the panels instead of their name (Issue 5637).
+// ZAP: 2022/06/08 Fix resizing issues.
 package org.parosproxy.paros.view;
 
 import java.awt.BorderLayout;
@@ -156,8 +157,8 @@ public class AbstractParamContainerPanel extends JSplitPane {
         this.setContinuousLayout(true);
         this.setRightComponent(getJPanel1());
         // ZAP: added more space for readability (was 175)
-        this.setDividerLocation(200);
-        this.setDividerSize(3);
+        this.setDividerLocation(DisplayUtils.getScaledSize(200));
+        this.setDividerSize(DisplayUtils.getScaledSize(3));
         this.setResizeWeight(0.3D);
         this.setBorder(
                 javax.swing.BorderFactory.createEtchedBorder(
diff --git a/zap/src/main/java/org/parosproxy/paros/view/OptionsDialog.java b/zap/src/main/java/org/parosproxy/paros/view/OptionsDialog.java
index f3b1b2705..5104260ab 100644
--- a/zap/src/main/java/org/parosproxy/paros/view/OptionsDialog.java
+++ b/zap/src/main/java/org/parosproxy/paros/view/OptionsDialog.java
@@ -23,6 +23,7 @@
 // ZAP: 2019/06/01 Normalise line endings.
 // ZAP: 2019/06/05 Normalise format/style.
 // ZAP: 2020/11/26 Use Log4j 2 classes for logging.
+// ZAP: 2022/06/08 Fix resizing issues.
 package org.parosproxy.paros.view;
 
 import java.awt.Frame;
@@ -37,6 +38,7 @@ import org.apache.logging.log4j.Logger;
 import org.parosproxy.paros.Constant;
 import org.parosproxy.paros.model.Model;
 import org.parosproxy.paros.model.OptionsParam;
+import org.zaproxy.zap.utils.DisplayUtils;
 
 public class OptionsDialog extends AbstractParamDialog {
 
@@ -61,10 +63,7 @@ public class OptionsDialog extends AbstractParamDialog {
     /** This method initializes this */
     private void initialize() {
 
-        // ZAP: Increase width and height of options dialog
-        // if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
-        this.setSize(750, 584);
-        // }
+        this.setSize(DisplayUtils.getScaledDimension(750, 584));
     }
 
     @Override
diff --git a/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyDialog.java b/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyDialog.java
index 768cb8ccf..489e106d7 100644
--- a/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyDialog.java
+++ b/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyDialog.java
@@ -32,6 +32,7 @@ import org.parosproxy.paros.Constant;
 import org.parosproxy.paros.core.scanner.Category;
 import org.parosproxy.paros.view.AbstractParamDialog;
 import org.parosproxy.paros.view.AbstractParamPanel;
+import org.zaproxy.zap.utils.DisplayUtils;
 
 public class PolicyDialog extends AbstractParamDialog {
 
@@ -58,7 +59,7 @@ public class PolicyDialog extends AbstractParamDialog {
 
     private void initialize() {
         this.setTitle(POLICY);
-        this.setSize(750, 420);
+        this.setSize(DisplayUtils.getScaledDimension(750, 420));
         addParamPanel(null, getPolicyAllCategoryPanel(), false);
 
         for (int i = 0; i < Category.getAllNames().length; i++) {
diff --git a/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyManagerDialog.java b/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyManagerDialog.java
index 9b9670967..ca54b1ca1 100644
--- a/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyManagerDialog.java
+++ b/zap/src/main/java/org/zaproxy/zap/extension/ascan/PolicyManagerDialog.java
@@ -19,7 +19,6 @@
  */
 package org.zaproxy.zap.extension.ascan;
 
-import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -41,6 +40,7 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.parosproxy.paros.Constant;
 import org.parosproxy.paros.view.View;
+import org.zaproxy.zap.utils.DisplayUtils;
 import org.zaproxy.zap.view.SingleColumnTableModel;
 import org.zaproxy.zap.view.StandardFieldsDialog;
 import org.zaproxy.zap.view.widgets.WritableFileChooser;
@@ -63,7 +63,7 @@ public class PolicyManagerDialog extends StandardFieldsDialog {
     private static final Logger logger = LogManager.getLogger(PolicyManagerDialog.class);
 
     public PolicyManagerDialog(Frame owner) {
-        super(owner, "ascan.policymgr.title", new Dimension(512, 400));
+        super(owner, "ascan.policymgr.title", DisplayUtils.getScaledDimension(512, 400));
     }
 
     public void init(ExtensionActiveScan extension) {
diff --git a/zap/src/main/java/org/zaproxy/zap/extension/brk/BreakPanelToolbarFactory.java b/zap/src/main/java/org/zaproxy/zap/extension/brk/BreakPanelToolbarFactory.java
index 32694a4c7..bd22e25e3 100644
--- a/zap/src/main/java/org/zaproxy/zap/extension/brk/BreakPanelToolbarFactory.java
+++ b/zap/src/main/java/org/zaproxy/zap/extension/brk/BreakPanelToolbarFactory.java
@@ -35,6 +35,7 @@ import org.parosproxy.paros.control.Control;
 import org.parosproxy.paros.view.TabbedPanel;
 import org.parosproxy.paros.view.View;
 import org.zaproxy.zap.extension.brk.impl.http.HttpBreakpointMessage;
+import org.zaproxy.zap.utils.DisplayUtils;
 import org.zaproxy.zap.utils.Stats;
 import org.zaproxy.zap.view.TabbedPanel2;
 import org.zaproxy.zap.view.ZapToggleButton;
@@ -51,6 +52,8 @@ import org.zaproxy.zap.view.ZapToggleButton;
 
 public class BreakPanelToolbarFactory {
 
+    private static final String ICON_RESOURCE_PATH = "/resource/icon/";
+
     private ContinueButtonAction continueButtonAction;
     private StepButtonAction stepButtonAction;
     private DropButtonAction dropButtonAction;
@@ -165,6 +168,12 @@ public class BreakPanelToolbarFactory {
         return ignoreRulesEnable;
     }
 
+    private static ImageIcon getScaledIcon(String path) {
+        return DisplayUtils.getScaledIcon(
+                new ImageIcon(
+                        BreakPanelToolbarFactory.class.getResource(ICON_RESOURCE_PATH + path)));
+    }
+
     private void setActiveIcon(boolean active) {
         if (active) {
             // Have to do this before the getParent() call
@@ -174,16 +183,11 @@ public class BreakPanelToolbarFactory {
             TabbedPanel parent = (TabbedPanel) breakPanel.getParent();
             if (active) {
                 parent.setIconAt(
-                        parent.indexOfComponent(breakPanel),
-                        new ImageIcon(
-                                BreakPanelToolbarFactory.class.getResource(
-                                        "/resource/icon/16/101.png"))); // Red X
+                        parent.indexOfComponent(breakPanel), getScaledIcon("16/101.png")); // Red X
             } else {
                 parent.setIconAt(
                         parent.indexOfComponent(breakPanel),
-                        new ImageIcon(
-                                BreakPanelToolbarFactory.class.getResource(
-                                        "/resource/icon/16/101grey.png"))); // Grey X
+                        getScaledIcon("16/101grey.png")); // Grey X
             }
             if (parent instanceof TabbedPanel2) {
                 // If possible lock the tab while it is active so it cant be closed
@@ -263,9 +267,8 @@ public class BreakPanelToolbarFactory {
         ZapToggleButton btnBreakRequest;
 
         btnBreakRequest = new ZapToggleButton(breakRequestsButtonAction);
-        btnBreakRequest.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource("/resource/icon/16/105r.png")));
+        btnBreakRequest.setSelectedIcon(getScaledIcon("16/105r.png"));
+
         btnBreakRequest.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.request.unset"));
 
@@ -276,9 +279,8 @@ public class BreakPanelToolbarFactory {
         ZapToggleButton btnBreakResponse;
 
         btnBreakResponse = new ZapToggleButton(breakResponsesButtonAction);
-        btnBreakResponse.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource("/resource/icon/16/106r.png")));
+        btnBreakResponse.setSelectedIcon(getScaledIcon("16/106r.png"));
+
         btnBreakResponse.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.response.unset"));
 
@@ -289,9 +291,8 @@ public class BreakPanelToolbarFactory {
         ZapToggleButton btnBreakAll;
 
         btnBreakAll = new ZapToggleButton(breakAllButtonAction);
-        btnBreakAll.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource("/resource/icon/16/151.png")));
+        btnBreakAll.setSelectedIcon(getScaledIcon("16/151.png"));
+
         btnBreakAll.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.all.unset"));
 
@@ -302,10 +303,7 @@ public class BreakPanelToolbarFactory {
         ZapToggleButton btnBreakOnJavaScript;
 
         btnBreakOnJavaScript = new ZapToggleButton(setBreakOnJavaScriptAction);
-        btnBreakOnJavaScript.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource(
-                                "/resource/icon/breakTypes/javascriptNotBreaking.png")));
+        btnBreakOnJavaScript.setSelectedIcon(getScaledIcon("breakTypes/javascriptNotBreaking.png"));
         btnBreakOnJavaScript.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.brkjavascript.set"));
 
@@ -317,9 +315,7 @@ public class BreakPanelToolbarFactory {
 
         btnBreakOnCssAndFonts = new ZapToggleButton(setBreakOnCssAndFontsAction);
         btnBreakOnCssAndFonts.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource(
-                                "/resource/icon/breakTypes/cssAndFontsNotBreaking.png")));
+                getScaledIcon("breakTypes/cssAndFontsNotBreaking.png"));
         btnBreakOnCssAndFonts.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.brkcssfonts.set"));
 
@@ -330,10 +326,7 @@ public class BreakPanelToolbarFactory {
         ZapToggleButton btnBreakOnMultimedia;
 
         btnBreakOnMultimedia = new ZapToggleButton(setBreakOnMultimediaAction);
-        btnBreakOnMultimedia.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource(
-                                "/resource/icon/breakTypes/multimediaNotBreaking.png")));
+        btnBreakOnMultimedia.setSelectedIcon(getScaledIcon("breakTypes/multimediaNotBreaking.png"));
         btnBreakOnMultimedia.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.brkmultimedia.set"));
 
@@ -344,10 +337,8 @@ public class BreakPanelToolbarFactory {
         ZapToggleButton btnOnlyBreakOnScope;
 
         btnOnlyBreakOnScope = new ZapToggleButton(setOnlyBreakOnScopeAction);
-        btnOnlyBreakOnScope.setSelectedIcon(
-                new ImageIcon(
-                        BreakPanelToolbarFactory.class.getResource(
-                                "/resource/icon/fugue/target.png")));
+        btnOnlyBreakOnScope.setSelectedIcon(getScaledIcon("fugue/target.png"));
+
         btnOnlyBreakOnScope.setSelectedToolTipText(
                 Constant.messages.getString("brk.toolbar.button.brkOnlyOnScope.unset"));
 
@@ -630,11 +621,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public ContinueButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/131.png")));
+            super(null, getScaledIcon("16/131.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.cont"));
@@ -660,11 +648,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public StepButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/143.png")));
+            super(null, getScaledIcon("16/143.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.step"));
@@ -694,11 +679,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public DropButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/150.png")));
+            super(null, getScaledIcon("16/150.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.bin"));
@@ -717,11 +699,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public AddBreakpointButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/break_add.png")));
+            super(null, getScaledIcon("16/break_add.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.brkpoint"));
@@ -738,11 +717,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public BreakRequestsButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/105.png")));
+            super(null, getScaledIcon("16/105.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.request.set"));
@@ -759,11 +735,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public BreakResponsesButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/106.png")));
+            super(null, getScaledIcon("16/106.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.response.set"));
@@ -780,11 +753,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public BreakAllButtonAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/16/152.png")));
+            super(null, getScaledIcon("16/152.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.all.set"));
@@ -801,11 +771,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public SetBreakOnJavaScriptAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/breakTypes/javascript.png")));
+            super(null, getScaledIcon("breakTypes/javascript.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.brkjavascript.unset"));
@@ -822,11 +789,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public SetBreakOnCssAndFontsAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/breakTypes/cssAndFonts.png")));
+            super(null, getScaledIcon("breakTypes/cssAndFonts.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.brkcssfonts.unset"));
@@ -843,11 +807,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public SetBreakOnMultimediaAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/breakTypes/multimedia.png")));
+            super(null, getScaledIcon("breakTypes/multimedia.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.brkmultimedia.unset"));
@@ -864,11 +825,8 @@ public class BreakPanelToolbarFactory {
         private static final long serialVersionUID = 1L;
 
         public SetBreakOnlyOnScopeAction() {
-            super(
-                    null,
-                    new ImageIcon(
-                            BreakPanelToolbarFactory.class.getResource(
-                                    "/resource/icon/fugue/target-grey.png")));
+            super(null, getScaledIcon("fugue/target-grey.png"));
+
             putValue(
                     Action.SHORT_DESCRIPTION,
                     Constant.messages.getString("brk.toolbar.button.brkOnlyOnScope.set"));
diff --git a/zap/src/main/java/org/zaproxy/zap/view/AboutPanel.java b/zap/src/main/java/org/zaproxy/zap/view/AboutPanel.java
index 6909ae6f4..a10e80fd7 100644
--- a/zap/src/main/java/org/zaproxy/zap/view/AboutPanel.java
+++ b/zap/src/main/java/org/zaproxy/zap/view/AboutPanel.java
@@ -20,7 +20,6 @@
 package org.zaproxy.zap.view;
 
 import java.awt.Color;
-import java.awt.Dimension;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
@@ -31,6 +30,7 @@ import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.UIManager;
 import org.parosproxy.paros.Constant;
+import org.zaproxy.zap.utils.DisplayUtils;
 import org.zaproxy.zap.utils.FontUtils;
 
 public class AboutPanel extends JPanel {
@@ -80,7 +80,7 @@ public class AboutPanel extends JPanel {
         GridBagConstraints gbcLogo = new GridBagConstraints();
 
         Color backgroundColor = new Color(UIManager.getColor("TextField.background").getRGB());
-        this.setPreferredSize(new Dimension(420, 460));
+        this.setPreferredSize(DisplayUtils.getScaledDimension(420, 460));
         this.setBackground(backgroundColor);
         this.setBorder(BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));