This is an automated email from the ASF dual-hosted git repository. ebakke pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit c01cb45759a68f1cf3ab1716bbb4b07d6a35487b Author: Eirik Bakke <[email protected]> AuthorDate: Sat Jan 25 14:59:42 2025 -0500 Replace 'new ImageIcon' with ImageUtilities.loadIcon in a few Swing forms that were constructed with the Matisse form builder. (To render at full HiDPI resolution, Icon/Image instances must be created via the methods in ImageUtilities rather than, in particular, the constructors of ImageIcon.) These cases were put in a separate commit since they involved re-generation of auto-generated code. To keep the patch simple, I excluded some reformatting of unrelated code that Matisse did when regenerating initComponents(). --- .../modules/jshell/editor/ExecutingGlassPanel.form | 4 ++-- .../modules/jshell/editor/ExecutingGlassPanel.java | 3 ++- .../beans/wizards/SpringXMLConfigNamespacesVisual.form | 2 +- .../beans/wizards/SpringXMLConfigNamespacesVisual.java | 2 +- .../modules/php/project/connections/sync/SyncPanel.form | 4 ++-- .../modules/php/project/connections/sync/SyncPanel.java | 2 +- .../web/clientproject/build/ui/AdvancedTasksPanel.form | 16 ++++++++-------- .../web/clientproject/build/ui/AdvancedTasksPanel.java | 10 +++++----- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.form b/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.form index d42ce1d7a4f..09fe8c40cdb 100644 --- a/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.form +++ b/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.form @@ -74,8 +74,8 @@ </Component> <Component class="javax.swing.JButton" name="stopButton"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/org/netbeans/modules/jshell/resources/stop.png"/> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/jshell/resources/stop.png")" type="code"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/jshell/editor/Bundle.properties" key="ExecutingGlassPanel.stopButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> diff --git a/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.java b/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.java index ea518c6f667..5161da85f2a 100644 --- a/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.java +++ b/java/jshell.support/src/org/netbeans/modules/jshell/editor/ExecutingGlassPanel.java @@ -20,6 +20,7 @@ package org.netbeans.modules.jshell.editor; import java.awt.event.ActionListener; import javax.swing.ImageIcon; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; /** @@ -77,7 +78,7 @@ final class ExecutingGlassPanel extends javax.swing.JPanel { )); org.openide.awt.Mnemonics.setLocalizedText(msgLabel, org.openide.util.NbBundle.getMessage(ExecutingGlassPanel.class, "ExecutingGlassPanel.msgLabel.text")); // NOI18N - stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/modules/jshell/resources/stop.png"))); // NOI18N + stopButton.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/jshell/resources/stop.png")); org.openide.awt.Mnemonics.setLocalizedText(stopButton, org.openide.util.NbBundle.getMessage(ExecutingGlassPanel.class, "ExecutingGlassPanel.stopButton.text")); // NOI18N stopButton.setBorder(null); stopButton.setBorderPainted(false); diff --git a/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.form b/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.form index 7b1bd440c8f..ba4797fa1e9 100644 --- a/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.form +++ b/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.form @@ -134,7 +134,7 @@ <Component class="javax.swing.JLabel" name="springNotOnClassPathLabel"> <Properties> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/spring/beans/resources/warning.gif")) " type="code"/> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/spring/beans/resources/warning.gif")" type="code"/> </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/spring/beans/wizards/Bundle.properties" key="LBL_SpringNotOnClassPath" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> diff --git a/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.java b/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.java index 35dfc592844..afda22a0767 100644 --- a/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.java +++ b/java/spring.beans/src/org/netbeans/modules/spring/beans/wizards/SpringXMLConfigNamespacesVisual.java @@ -140,7 +140,7 @@ public final class SpringXMLConfigNamespacesVisual extends JPanel { } }); - springNotOnClassPathLabel.setIcon(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/spring/beans/resources/warning.gif")) ); + springNotOnClassPathLabel.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/spring/beans/resources/warning.gif")); org.openide.awt.Mnemonics.setLocalizedText(springNotOnClassPathLabel, org.openide.util.NbBundle.getMessage(SpringXMLConfigNamespacesVisual.class, "LBL_SpringNotOnClassPath")); // NOI18N cbSpringVersion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No Library found" })); diff --git a/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.form b/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.form index a8931c616f3..ad2227897e5 100644 --- a/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.form +++ b/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.form @@ -325,8 +325,8 @@ <SubComponents> <Component class="javax.swing.JButton" name="diffButton"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/org/netbeans/modules/php/project/ui/resources/diff.png"/> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/php/project/ui/resources/diff.png")" type="code"/> </Property> <Property name="enabled" type="boolean" value="false"/> </Properties> diff --git a/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java b/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java index 77fa8f0f293..a9260f3a3e3 100644 --- a/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java +++ b/php/php.project/src/org/netbeans/modules/php/project/connections/sync/SyncPanel.java @@ -1238,7 +1238,7 @@ public final class SyncPanel extends JPanel implements HelpCtx.Provider { .addGap(5, 5, 5)) ); - diffButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/php/project/ui/resources/diff.png"))); // NOI18N + diffButton.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/php/project/ui/resources/diff.png")); diffButton.setEnabled(false); operationButtonsPanel.add(diffButton); diff --git a/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.form b/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.form index e6a6dc583ff..fa4dbf3fb74 100644 --- a/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.form +++ b/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.form @@ -131,8 +131,8 @@ </Container> <Component class="javax.swing.JButton" name="addButton"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/org/netbeans/modules/web/clientproject/ui/resources/add.png"/> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/add.png")" type="code"/> </Property> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/web/clientproject/build/ui/Bundle.properties" key="AdvancedTasksPanel.addButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> @@ -144,8 +144,8 @@ </Component> <Component class="javax.swing.JButton" name="removeButton"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/org/netbeans/modules/web/clientproject/ui/resources/remove.png"/> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/remove.png")" type="code"/> </Property> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/web/clientproject/build/ui/Bundle.properties" key="AdvancedTasksPanel.removeButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> @@ -157,8 +157,8 @@ </Component> <Component class="javax.swing.JButton" name="upButton"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/org/netbeans/modules/web/clientproject/ui/resources/up.png"/> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/up.png")" type="code"/> </Property> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/web/clientproject/build/ui/Bundle.properties" key="AdvancedTasksPanel.upButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> @@ -170,8 +170,8 @@ </Component> <Component class="javax.swing.JButton" name="downButton"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/org/netbeans/modules/web/clientproject/ui/resources/down.png"/> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/down.png")" type="code"/> </Property> <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/web/clientproject/build/ui/Bundle.properties" key="AdvancedTasksPanel.downButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> diff --git a/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.java b/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.java index 3a9c9309a89..7f675c66ae9 100644 --- a/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.java +++ b/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/build/ui/AdvancedTasksPanel.java @@ -35,7 +35,6 @@ import javax.swing.AbstractListModel; import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListCellRenderer; import javax.swing.GroupLayout; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -60,6 +59,7 @@ import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.awt.Mnemonics; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; @@ -334,7 +334,7 @@ public final class AdvancedTasksPanel extends JPanel { tasksList.setMinimumSize(new Dimension(60, 80)); tasksScrollPane.setViewportView(tasksList); - addButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/web/clientproject/ui/resources/add.png"))); // NOI18N + addButton.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/add.png")); addButton.setToolTipText(NbBundle.getMessage(AdvancedTasksPanel.class, "AdvancedTasksPanel.addButton.toolTipText")); // NOI18N addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -342,7 +342,7 @@ public final class AdvancedTasksPanel extends JPanel { } }); - removeButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/web/clientproject/ui/resources/remove.png"))); // NOI18N + removeButton.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/remove.png")); removeButton.setToolTipText(NbBundle.getMessage(AdvancedTasksPanel.class, "AdvancedTasksPanel.removeButton.toolTipText")); // NOI18N removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -350,7 +350,7 @@ public final class AdvancedTasksPanel extends JPanel { } }); - upButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/web/clientproject/ui/resources/up.png"))); // NOI18N + upButton.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/up.png")); upButton.setToolTipText(NbBundle.getMessage(AdvancedTasksPanel.class, "AdvancedTasksPanel.upButton.toolTipText")); // NOI18N upButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -358,7 +358,7 @@ public final class AdvancedTasksPanel extends JPanel { } }); - downButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/web/clientproject/ui/resources/down.png"))); // NOI18N + downButton.setIcon(ImageUtilities.loadIcon("org/netbeans/modules/web/clientproject/ui/resources/down.png")); downButton.setToolTipText(NbBundle.getMessage(AdvancedTasksPanel.class, "AdvancedTasksPanel.downButton.toolTipText")); // NOI18N downButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
