diff --git a/contrib/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java b/contrib/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java index 59d95bfff91b..9ace5fc5826e 100644 --- a/contrib/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java +++ b/contrib/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java @@ -158,8 +158,7 @@ private final class Info implements ProjectInformation { @Override public Icon getIcon() { - Image image = ImageUtilities.loadImage(GrailsConstants.GRAILS_ICON_16x16); - return image == null ? null : new ImageIcon(image); + return ImageUtilities.loadIcon(GrailsConstants.GRAILS_ICON_16x16); } @Override diff --git a/enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/ui/LogicalViewNode.java b/enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/ui/LogicalViewNode.java index bfe065f7f64d..5d8d4644536e 100644 --- a/enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/ui/LogicalViewNode.java +++ b/enterprise/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/ui/LogicalViewNode.java @@ -78,8 +78,8 @@ public Image getOpenedIcon( int type ) { static synchronized Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/ddloaders/multiview/CustomSectionNodePanel.java b/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/ddloaders/multiview/CustomSectionNodePanel.java index 504a741942b2..419b2003f1a6 100644 --- a/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/ddloaders/multiview/CustomSectionNodePanel.java +++ b/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/ddloaders/multiview/CustomSectionNodePanel.java @@ -41,8 +41,7 @@ public CustomSectionNodePanel(final SectionNode node) { } public void setTitleIcon(String iconBase) { - Image iconImage = ImageUtilities.loadImage(iconBase, true); - getTitleButton().setIcon(iconImage != null ? new ImageIcon(iconImage) : null); + getTitleButton().setIcon(ImageUtilities.loadImageIcon(iconBase, true)); } // @Override diff --git a/enterprise/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ChangelogWildflyPlugin.java b/enterprise/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ChangelogWildflyPlugin.java index 8ac55972793d..b567a3a07284 100644 --- a/enterprise/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ChangelogWildflyPlugin.java +++ b/enterprise/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ChangelogWildflyPlugin.java @@ -23,7 +23,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.prefs.Preferences; -import javax.swing.ImageIcon; import javax.swing.JLabel; import org.openide.awt.NotificationDisplayer; import org.openide.awt.NotificationDisplayer.Category; @@ -44,7 +43,7 @@ public static void showChangelog() { int version = Integer.parseInt(NbBundle.getMessage(ChangelogWildflyPlugin.class, VERSION_PREF)); if (prefs.getInt(VERSION_PREF, 5) < version) { NotificationDisplayer.getDefault().notify(NbBundle.getMessage(ChangelogWildflyPlugin.class, "MSG_CHANGES_TITLE"), - new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javaee/wildfly/resources/wildfly.png")), + ImageUtilities.loadImageIcon("org/netbeans/modules/javaee/wildfly/resources/wildfly.png", false), new JLabel(NbBundle.getMessage(ChangelogWildflyPlugin.class, "MSG_CHANGES_SUMMARY")), new JLabel(NbBundle.getMessage(ChangelogWildflyPlugin.class, "MSG_CHANGES_DESC")), NotificationDisplayer.Priority.NORMAL, Category.INFO); diff --git a/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsClientRootNode.java b/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsClientRootNode.java index bd9432c1659c..cb426434ce3a 100644 --- a/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsClientRootNode.java +++ b/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsClientRootNode.java @@ -78,8 +78,8 @@ private java.awt.Image getServicesImage() { private Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsRootNode.java b/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsRootNode.java index f4ececf7c611..1f0198a15b43 100644 --- a/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsRootNode.java +++ b/enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/nodes/JaxWsRootNode.java @@ -78,8 +78,8 @@ private java.awt.Image getServicesImage() { private Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/PageFlowToolbarUtilities.java b/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/PageFlowToolbarUtilities.java index 4e16e4e513e4..2cb391d83c02 100644 --- a/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/PageFlowToolbarUtilities.java +++ b/enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/PageFlowToolbarUtilities.java @@ -28,7 +28,6 @@ package org.netbeans.modules.web.jsf.navigation; import java.awt.Dimension; -import java.awt.Image; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; @@ -44,7 +43,7 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import javax.swing.ImageIcon; +import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComboBox; import org.openide.util.ImageUtilities; @@ -194,7 +193,7 @@ public void itemStateChanged(ItemEvent event) { scopeBox = comboBox; return comboBox; } - private static final Image LAYOUT_ICON = ImageUtilities.loadImage("org/netbeans/modules/web/jsf/navigation/resources/navigation.gif"); // NOI18N + private static final Icon LAYOUT_ICON = ImageUtilities.loadIcon("org/netbeans/modules/web/jsf/navigation/resources/navigation.gif"); // NOI18N private JButton layoutButton = null; /** @@ -209,7 +208,7 @@ public JButton createLayoutButton() { return layoutButton; } - layoutButton = new JButton(new ImageIcon(LAYOUT_ICON)); + layoutButton = new JButton(LAYOUT_ICON); //Set the appropriate size of the combo box so it doesn't take up the whole page. // Dimension prefSize = layoutButton.getPreferredSize(); // layoutButton.setMinimumSize(prefSize); diff --git a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/ProjectWebServiceNodeFactory.java b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/ProjectWebServiceNodeFactory.java index faafd4680bc9..d4b810b8f014 100644 --- a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/ProjectWebServiceNodeFactory.java +++ b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/ProjectWebServiceNodeFactory.java @@ -320,8 +320,8 @@ private java.awt.Image getServicesImage() { private Icon getFolderIcon(boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientRootNode.java b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientRootNode.java index b7a337a13a79..1af2903228f3 100644 --- a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientRootNode.java +++ b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientRootNode.java @@ -82,8 +82,8 @@ private java.awt.Image getServicesImage() { private Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsRootNode.java b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsRootNode.java index bcb2409461d6..5ebec20cdef6 100644 --- a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsRootNode.java +++ b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsRootNode.java @@ -95,8 +95,8 @@ private java.awt.Image getServicesImage() { private Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/view/ZoomManager.java b/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/view/ZoomManager.java index f092a3eef5d6..1adca11d0881 100644 --- a/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/view/ZoomManager.java +++ b/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/view/ZoomManager.java @@ -20,7 +20,6 @@ package org.netbeans.modules.websvc.design.view; import java.awt.Dimension; -import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; @@ -30,7 +29,7 @@ import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.DefaultComboBoxModel; -import javax.swing.ImageIcon; +import javax.swing.Icon; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JScrollPane; @@ -41,7 +40,6 @@ import org.netbeans.api.visual.widget.Scene; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; -import org.openide.util.Utilities; /** * Manages the zoom level for a particular Scene instance. @@ -497,9 +495,9 @@ public FitDiagramAction(ZoomManager manager) { this.manager = manager; String path = NbBundle.getMessage(FitDiagramAction.class, "IMG_FitDiagramAction"); - Image img = ImageUtilities.loadImage(path); - if (img != null) { - putValue(Action.SMALL_ICON, new ImageIcon(img)); + Icon icon = ImageUtilities.loadIcon(path); + if (icon != null) { + putValue(Action.SMALL_ICON, icon); } String desc = NbBundle.getMessage(FitDiagramAction.class, "LBL_FitDiagramAction"); @@ -543,9 +541,9 @@ public FitWidthAction(ZoomManager manager) { this.manager = manager; String path = NbBundle.getMessage(FitWidthAction.class, "IMG_FitWidthAction"); - Image img = ImageUtilities.loadImage(path); - if (img != null) { - putValue(Action.SMALL_ICON, new ImageIcon(img)); + Icon icon = ImageUtilities.loadIcon(path); + if (icon != null) { + putValue(Action.SMALL_ICON, icon); } String desc = NbBundle.getMessage(FitWidthAction.class, "LBL_FitWidthAction"); @@ -586,9 +584,9 @@ public ZoomDefaultAction(ZoomManager manager) { this.manager = manager; String path = NbBundle.getMessage(ZoomDefaultAction.class, "IMG_ZoomDefaultAction"); - Image img = ImageUtilities.loadImage(path); - if (img != null) { - putValue(Action.SMALL_ICON, new ImageIcon(img)); + Icon icon = ImageUtilities.loadIcon(path); + if (icon != null) { + putValue(Action.SMALL_ICON, icon); } String desc = NbBundle.getMessage(ZoomDefaultAction.class, "LBL_ZoomDefaultAction"); @@ -618,9 +616,9 @@ public ZoomInAction(ZoomManager manager) { this.manager = manager; String path = NbBundle.getMessage(ZoomInAction.class, "IMG_ZoomInAction"); - Image img = ImageUtilities.loadImage(path); - if (img != null) { - putValue(Action.SMALL_ICON, new ImageIcon(img)); + Icon icon = ImageUtilities.loadIcon(path); + if (icon != null) { + putValue(Action.SMALL_ICON, icon); } String desc = NbBundle.getMessage(ZoomInAction.class, "LBL_ZoomInAction"); @@ -657,9 +655,9 @@ public ZoomOutAction(ZoomManager manager) { this.manager = manager; String path = NbBundle.getMessage(ZoomOutAction.class, "IMG_ZoomOutAction"); - Image img = ImageUtilities.loadImage(path); - if (img != null) { - putValue(Action.SMALL_ICON, new ImageIcon(img)); + Icon icon = ImageUtilities.loadIcon(path); + if (icon != null) { + putValue(Action.SMALL_ICON, icon); } String desc = NbBundle.getMessage(ZoomOutAction.class, "LBL_ZoomOutAction"); diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/HttpMethodsNode.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/HttpMethodsNode.java index cd026cfe91a8..d459ca82e451 100644 --- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/HttpMethodsNode.java +++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/HttpMethodsNode.java @@ -67,8 +67,8 @@ public Image getOpenedIcon( int type ) { static synchronized Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/RestServicesNode.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/RestServicesNode.java index 04fa8df17d7f..706b56373ae1 100644 --- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/RestServicesNode.java +++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/RestServicesNode.java @@ -73,8 +73,8 @@ public Image getOpenedIcon(int type) { static synchronized Icon getFolderIcon(boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/SubResourceLocatorsNode.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/SubResourceLocatorsNode.java index a3f7ef68c824..02f472364680 100644 --- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/SubResourceLocatorsNode.java +++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/nodes/SubResourceLocatorsNode.java @@ -67,8 +67,8 @@ public Image getOpenedIcon( int type ) { static synchronized Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/groovy/groovy.refactoring/src/org/netbeans/modules/groovy/refactoring/ui/WhereUsedPanel.java b/groovy/groovy.refactoring/src/org/netbeans/modules/groovy/refactoring/ui/WhereUsedPanel.java index 2694e2cc164a..e66810821836 100644 --- a/groovy/groovy.refactoring/src/org/netbeans/modules/groovy/refactoring/ui/WhereUsedPanel.java +++ b/groovy/groovy.refactoring/src/org/netbeans/modules/groovy/refactoring/ui/WhereUsedPanel.java @@ -206,7 +206,7 @@ private void setupScope() { } catch (DataObjectNotFoundException ex) { } // Not important, only for Icon. customScope = new JLabel(NbBundle.getMessage(WhereUsedPanel.class, "LBL_CustomScope"), pi.getIcon(), SwingConstants.LEFT); //NOI18N - currentFile = new JLabel(NbBundle.getMessage(WhereUsedPanel.class, "LBL_CurrentFile", fo.getNameExt()), currentFileDo != null ? new ImageIcon(currentFileDo.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)) : pi.getIcon(), SwingConstants.LEFT); //NOI18N + currentFile = new JLabel(NbBundle.getMessage(WhereUsedPanel.class, "LBL_CurrentFile", fo.getNameExt()), currentFileDo != null ? ImageUtilities.image2Icon(currentFileDo.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)) : pi.getIcon(), SwingConstants.LEFT); //NOI18N currentPackage = new JLabel(NbBundle.getMessage(WhereUsedPanel.class, "LBL_CurrentPackage", packageName), ImageUtilities.loadImageIcon(PACKAGE, false), SwingConstants.LEFT); //NOI18N currentProject = new JLabel(NbBundle.getMessage(WhereUsedPanel.class, "LBL_CurrentProject", pi.getDisplayName()), pi.getIcon(), SwingConstants.LEFT); //NOI18N allProjects = new JLabel(NbBundle.getMessage(WhereUsedPanel.class, "LBL_AllProjects"), pi.getIcon(), SwingConstants.LEFT); //NOI18N diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java index fc76975ee794..4db433574459 100644 --- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java +++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java @@ -174,7 +174,7 @@ public void requestFocus() { if (borderColor == null) borderColor = UIManager.getColor("controlShadow"); // NOI18N tableScrollPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, borderColor)); - ImageIcon ic = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugtracking/commons/resources/columns_16.png", true)); // NOI18N + ImageIcon ic = ImageUtilities.loadImageIcon("org/netbeans/modules/bugtracking/commons/resources/columns_16.png", true); // NOI18N colsButton = new javax.swing.JButton(ic); colsButton.getAccessibleContext().setAccessibleName(NbBundle.getMessage(TreeTableView.class, "ACN_ColumnsSelector")); //NOI18N colsButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TreeTableView.class, "ACD_ColumnsSelector")); //NOI18N diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java index 1b610f8c7ab6..a7f55a417cf1 100644 --- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java +++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java @@ -54,7 +54,7 @@ public class QueryTableCellRenderer extends DefaultTableCellRenderer { private final IssueTable issueTable; private static final int VISIBLE_START_CHARS = 0; - private static final Icon seenValueIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugtracking/commons/resources/seen-value.png")); // NOI18N + private static final Icon seenValueIcon = ImageUtilities.loadIcon("org/netbeans/modules/bugtracking/commons/resources/seen-value.png"); // NOI18N private static final MessageFormat issueNewFormat = getFormat("issueNewFormat", UIUtils.getTaskNewColor()); //NOI18N private static final MessageFormat issueObsoleteFormat = getFormat("issueObsoleteFormat", UIUtils.getTaskObsoleteColor()); //NOI18N diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableHeaderRenderer.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableHeaderRenderer.java index 943abb4d9486..69fcd46ecc49 100644 --- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableHeaderRenderer.java +++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableHeaderRenderer.java @@ -33,7 +33,7 @@ class QueryTableHeaderRenderer extends DefaultTableCellRenderer { private final JLabel seenCell = new JLabel(); - private static final Icon seenHeaderIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugtracking/commons/resources/seen-header.png")); // NOI18N + private static final Icon seenHeaderIcon = ImageUtilities.loadIcon("org/netbeans/modules/bugtracking/commons/resources/seen-header.png"); // NOI18N private final TableCellRenderer delegate; private final IssueTable issueTable; private boolean isSaved; diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/TableSorter.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/TableSorter.java index b64dc72e2915..21fdb176ab82 100644 --- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/TableSorter.java +++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/TableSorter.java @@ -118,8 +118,8 @@ public int compare(Object o1, Object o2) { } }; - private final Icon ICON_ASCENDING = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/openide/explorer/columnsSortedAsc.gif", true)); // NOI18N - private final Icon ICON_DESCENDING = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/openide/explorer/columnsSortedDesc.gif", true)); // NOI18N + private final Icon ICON_ASCENDING = ImageUtilities.loadImageIcon("org/netbeans/modules/openide/explorer/columnsSortedAsc.gif", true); // NOI18N + private final Icon ICON_DESCENDING = ImageUtilities.loadImageIcon("org/netbeans/modules/openide/explorer/columnsSortedDesc.gif", true); // NOI18N private Row[] viewToModel; private int[] modelToView; diff --git a/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/ErrorNode.java b/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/ErrorNode.java index 927a1b763ff1..e7fc56f21c00 100644 --- a/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/ErrorNode.java +++ b/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/ErrorNode.java @@ -51,7 +51,7 @@ public ErrorNode(String text, Action refreshAction) { this.defaultAction = refreshAction; btnRefresh = new LinkButton(NbBundle.getMessage(ErrorNode.class, "LBL_Retry"), refreshAction); //NOI18N lblMessage = new TreeLabel(text); - lblMessage.setIcon(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugtracking/tasks/resources/error.png"))); //NOI18N + lblMessage.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/bugtracking/tasks/resources/error.png", false)); //NOI18N } @Override diff --git a/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/RepositoryNode.java b/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/RepositoryNode.java index c2e02e89e3fa..b2ecef07e3ae 100644 --- a/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/RepositoryNode.java +++ b/ide/bugtracking/src/org/netbeans/modules/bugtracking/tasks/dashboard/RepositoryNode.java @@ -324,15 +324,13 @@ Collection getQueries() { return repository.getQueries(); } - ImageIcon getIcon() { + Icon getIcon() { Image icon = repository.getIcon(); - ImageIcon imageIcon; if (icon == null) { - imageIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/bugtracking/tasks/resources/remote_repo.png", true); + return ImageUtilities.loadImageIcon("org/netbeans/modules/bugtracking/tasks/resources/remote_repo.png", true); } else { - imageIcon = new ImageIcon(icon); + return ImageUtilities.image2Icon(icon); } - return imageIcon; } @Override diff --git a/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboRenderer.java b/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboRenderer.java index c0ce15f6b530..f8a586048e39 100644 --- a/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboRenderer.java +++ b/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/repository/RepositoryComboRenderer.java @@ -24,11 +24,11 @@ import java.awt.Image; import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JList; import org.netbeans.modules.bugtracking.RepositoryImpl; import org.netbeans.modules.bugtracking.api.Repository; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; /** @@ -85,7 +85,7 @@ public Component getListCellRendererComponent(JList list, Object value, int inde if(icon instanceof Icon) { label.setIcon((Icon) icon); } else if(icon instanceof Image) { - label.setIcon(new ImageIcon(icon)); + label.setIcon(ImageUtilities.image2Icon(icon)); } } else { Font font = label.getFont(); diff --git a/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositoryFormPanel.java b/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositoryFormPanel.java index c2b168b9acc8..48172c2bedc3 100644 --- a/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositoryFormPanel.java +++ b/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositoryFormPanel.java @@ -91,8 +91,8 @@ private void initComponents() { errorLabel = new JLabel(); errorLabel.setForeground(ERROR_COLOR); - errorLabel.setIcon(new ImageIcon(ImageUtilities.loadImage( - "org/netbeans/modules/bugtracking/ui/resources/error.gif"))); //NOI18N + errorLabel.setIcon(ImageUtilities.loadImageIcon( + "org/netbeans/modules/bugtracking/ui/resources/error.gif", false)); //NOI18N errorText = new JTextArea(); errorText.setForeground(ERROR_COLOR); errorText.setBackground(errorLabel.getBackground()); diff --git a/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorBuilder.java b/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorBuilder.java index c9af1ae0b804..fe931f47e5fe 100644 --- a/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorBuilder.java +++ b/ide/bugtracking/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorBuilder.java @@ -38,8 +38,6 @@ import javax.swing.BoxLayout; import static javax.swing.BoxLayout.X_AXIS; import static javax.swing.BoxLayout.Y_AXIS; -import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JComponent; import static javax.swing.JComponent.LEFT_ALIGNMENT; @@ -67,6 +65,7 @@ import org.openide.DialogDescriptor; import org.openide.awt.Mnemonics; import org.openide.util.HelpCtx; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; /** @@ -766,7 +765,7 @@ public Component getListCellRendererComponent(JList list, cellHasFocus); if (r instanceof JLabel) { JLabel label = (JLabel) r; - label.setIcon(new ImageIcon(icon)); + label.setIcon(ImageUtilities.image2Icon(icon)); } return r; } diff --git a/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java b/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java index 2a3f353d9824..fbdf0e4c7324 100644 --- a/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java +++ b/ide/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java @@ -123,7 +123,6 @@ import org.netbeans.modules.mylyn.util.NbDateRange; import org.netbeans.modules.spellchecker.api.Spellchecker; import org.netbeans.modules.team.ide.spi.IDEServices; -import org.netbeans.modules.team.spi.TeamAccessorUtils; import org.openide.awt.HtmlBrowser; import org.openide.filesystems.FileUtil; import org.openide.nodes.Node; @@ -1480,25 +1479,25 @@ private void updateMessagePanel() { JLabel noSummaryLabel = new JLabel(); noSummaryLabel.setText(NbBundle.getMessage(IssuePanel.class, "IssuePanel.noSummary")); // NOI18N String icon = issue.isNew() ? "org/netbeans/modules/bugzilla/resources/info.png" : "org/netbeans/modules/bugzilla/resources/error.gif"; // NOI18N - noSummaryLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(icon))); + noSummaryLabel.setIcon(ImageUtilities.loadImageIcon(icon, false)); messagePanel.add(noSummaryLabel); } if (cyclicDependency) { JLabel cyclicDependencyLabel = new JLabel(); cyclicDependencyLabel.setText(NbBundle.getMessage(IssuePanel.class, "IssuePanel.cyclicDependency")); // NOI18N - cyclicDependencyLabel.setIcon(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugzilla/resources/error.gif"))); // NOI18N + cyclicDependencyLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/bugzilla/resources/error.gif", false)); // NOI18N messagePanel.add(cyclicDependencyLabel); } if (invalidKeyword) { JLabel invalidKeywordLabel = new JLabel(); invalidKeywordLabel.setText(NbBundle.getMessage(IssuePanel.class, "IssuePanel.invalidKeyword")); // NOI18N - invalidKeywordLabel.setIcon(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugzilla/resources/error.gif"))); // NOI18N + invalidKeywordLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/bugzilla/resources/error.gif", false)); // NOI18N messagePanel.add(invalidKeywordLabel); } if (noDuplicateId) { JLabel noDuplicateLabel = new JLabel(); noDuplicateLabel.setText(NbBundle.getMessage(IssuePanel.class, "IssuePanel.noDuplicateId")); // NOI18N - noDuplicateLabel.setIcon(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/bugzilla/resources/error.gif"))); // NOI18N + noDuplicateLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/bugzilla/resources/error.gif", false)); // NOI18N messagePanel.add(noDuplicateLabel); } if (noSummary || cyclicDependency || invalidKeyword || noComponent || noVersion || noTargetMilestione || noDuplicateId || (noReproducibility && issue.isNew())) { @@ -1530,7 +1529,7 @@ void addMessage(String messageKey) { JLabel messageLabel = new JLabel(); messageLabel.setText(NbBundle.getMessage(IssuePanel.class, messageKey)); String icon = issue.isNew() ? "org/netbeans/modules/bugzilla/resources/info.png" : "org/netbeans/modules/bugzilla/resources/error.gif"; // NOI18N - messageLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(icon))); + messageLabel.setIcon(ImageUtilities.loadImageIcon(icon, false)); messagePanel.add(messageLabel); } diff --git a/ide/csl.api/src/org/netbeans/modules/csl/editor/completion/GsfCompletionItem.java b/ide/csl.api/src/org/netbeans/modules/csl/editor/completion/GsfCompletionItem.java index ea1dbf49c8b3..8e0b8ea1eb9a 100644 --- a/ide/csl.api/src/org/netbeans/modules/csl/editor/completion/GsfCompletionItem.java +++ b/ide/csl.api/src/org/netbeans/modules/csl/editor/completion/GsfCompletionItem.java @@ -41,7 +41,6 @@ import org.netbeans.modules.csl.api.CodeCompletionResult; import org.netbeans.modules.csl.api.ElementKind; import org.netbeans.modules.csl.spi.DefaultCompletionProposal; -import org.netbeans.modules.csl.spi.DefaultCompletionResult; import org.netbeans.spi.editor.completion.CompletionDocumentation; import org.netbeans.spi.editor.completion.CompletionItem; import org.netbeans.spi.editor.completion.CompletionResultSet; @@ -390,7 +389,7 @@ private TruncationItem() { } @Override protected ImageIcon getIcon() { - return new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/csl/editor/completion/warning.png")); // NOI18N + return ImageUtilities.loadImageIcon("org/netbeans/modules/csl/editor/completion/warning.png", false); // NOI18N } public int getSortPriority() { diff --git a/ide/csl.api/src/org/netbeans/modules/csl/navigation/ClassMemberFilters.java b/ide/csl.api/src/org/netbeans/modules/csl/navigation/ClassMemberFilters.java index 41f447a34b3c..0222e0fa16da 100644 --- a/ide/csl.api/src/org/netbeans/modules/csl/navigation/ClassMemberFilters.java +++ b/ide/csl.api/src/org/netbeans/modules/csl/navigation/ClassMemberFilters.java @@ -147,28 +147,28 @@ private static FiltersManager createFilters () { NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowInherited"), //NOI18N NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowInheritedTip"), //NOI18N false, - new ImageIcon (ImageUtilities.loadImage("org/netbeans/modules/csl/navigation/resources/filterHideInherited.png")), //NOI18N + ImageUtilities.loadImageIcon("org/netbeans/modules/csl/navigation/resources/filterHideInherited.png", false), //NOI18N null ); desc.addFilter(SHOW_FIELDS, NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowFields"), //NOI18N NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowFieldsTip"), //NOI18N true, - new ImageIcon (ImageUtilities.loadImage("org/netbeans/modules/csl/navigation/resources/filterHideFields.gif")), //NOI18N + ImageUtilities.loadImageIcon("org/netbeans/modules/csl/navigation/resources/filterHideFields.gif", false), //NOI18N null ); desc.addFilter(SHOW_STATIC, NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowStatic"), //NOI18N NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowStaticTip"), //NOI18N true, - new ImageIcon (ImageUtilities.loadImage("org/netbeans/modules/csl/navigation/resources/filterHideStatic.png")), //NOI18N + ImageUtilities.loadImageIcon("org/netbeans/modules/csl/navigation/resources/filterHideStatic.png", false), //NOI18N null ); desc.addFilter(SHOW_NON_PUBLIC, NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowNonPublic"), //NOI18N NbBundle.getMessage(ClassMemberFilters.class, "LBL_ShowNonPublicTip"), //NOI18N true, - new ImageIcon (ImageUtilities.loadImage("org/netbeans/modules/csl/navigation/resources/filterHideNonPublic.png")), //NOI18N + ImageUtilities.loadImageIcon("org/netbeans/modules/csl/navigation/resources/filterHideNonPublic.png", false), //NOI18N null ); diff --git a/ide/csl.api/src/org/netbeans/modules/csl/navigation/ElementScanningTask.java b/ide/csl.api/src/org/netbeans/modules/csl/navigation/ElementScanningTask.java index c343da0cfe6c..9f424c6b31fe 100644 --- a/ide/csl.api/src/org/netbeans/modules/csl/navigation/ElementScanningTask.java +++ b/ide/csl.api/src/org/netbeans/modules/csl/navigation/ElementScanningTask.java @@ -421,7 +421,7 @@ public long getEndPosition() { public ImageIcon getCustomIcon() { String iconBase = language.getIconBase(); - return iconBase == null ? null : new ImageIcon(ImageUtilities.loadImage(iconBase)); + return iconBase == null ? null : ImageUtilities.loadImageIcon(iconBase, false); } } } diff --git a/ide/csl.api/src/org/netbeans/modules/csl/navigation/Icons.java b/ide/csl.api/src/org/netbeans/modules/csl/navigation/Icons.java index 22787c85ab35..d6fca106d3cd 100644 --- a/ide/csl.api/src/org/netbeans/modules/csl/navigation/Icons.java +++ b/ide/csl.api/src/org/netbeans/modules/csl/navigation/Icons.java @@ -18,9 +18,9 @@ */ package org.netbeans.modules.csl.navigation; -import java.awt.Image; import java.util.Collection; import java.util.Collections; +import javax.swing.Icon; import javax.swing.ImageIcon; import org.netbeans.modules.csl.api.ElementKind; import org.netbeans.modules.csl.api.Modifier; @@ -47,121 +47,66 @@ public final class Icons { private Icons() { } -// public static Icon getBusyIcon() { -// Image img = Utilities.loadImage(WAIT); -// -// if (img == null) { -// return null; -// } else { -// return new ImageIcon(img); -// } -// } -// -// public static Icon getMethodIcon() { -// // TODO - consider modifiers -// Image img = -// Utilities.loadImage(ICON_BASE + "method" + "Public" + PNG_EXTENSION); -// -// if (img == null) { -// return null; -// } else { -// return new ImageIcon(img); -// } -// } -// -// public static Icon getFieldIcon() { -// // TODO - consider modifiers -// Image img = -// Utilities.loadImage(ICON_BASE + "field" + "Public" + PNG_EXTENSION); -// -// if (img == null) { -// return null; -// } else { -// return new ImageIcon(img); -// } -// } -// -// public static Icon getClassIcon() { -// Image img = Utilities.loadImage(ICON_BASE + "class" + PNG_EXTENSION); -// -// if (img == null) { -// return null; -// } else { -// return new ImageIcon(img); -// } -// } -// -// public static Icon getModuleIcon() { -// Image img = -// Utilities.loadImage(ICON_BASE + "package" + GIF_EXTENSION); -// -// if (img == null) { -// return null; -// } else { -// return new ImageIcon(img); -// } -// } - public static ImageIcon getElementIcon( ElementKind elementKind, Collection modifiers ) { if ( modifiers == null ) { modifiers = Collections.emptyList(); } - Image img = null; + Icon icon = null; switch( elementKind ) { case FILE: - img = ImageUtilities.loadImage( ICON_BASE + "emptyfile-icon" + PNG_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "emptyfile-icon" + PNG_EXTENSION ); break; case ERROR: - img = ImageUtilities.loadImage( ICON_BASE + "error-glyph" + GIF_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "error-glyph" + GIF_EXTENSION ); break; case PACKAGE: case MODULE: - img = ImageUtilities.loadImage( ICON_BASE + "package" + GIF_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "package" + GIF_EXTENSION ); break; case TEST: - img = ImageUtilities.loadImage( ICON_BASE + "test" + PNG_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "test" + PNG_EXTENSION ); break; case CLASS: case INTERFACE: - img = ImageUtilities.loadImage( ICON_BASE + "class" + PNG_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "class" + PNG_EXTENSION ); break; case TAG: - img = ImageUtilities.loadImage( ICON_BASE + "html_element" + PNG_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "html_element" + PNG_EXTENSION ); break; case RULE: - img = ImageUtilities.loadImage( ICON_BASE + "rule" + PNG_EXTENSION ); + icon = ImageUtilities.loadIcon( ICON_BASE + "rule" + PNG_EXTENSION ); break; case VARIABLE: case PROPERTY: case GLOBAL: case ATTRIBUTE: case FIELD: - img = ImageUtilities.loadImage( getIconName( ICON_BASE + "field", PNG_EXTENSION, modifiers ) ); + icon = ImageUtilities.loadIcon( getIconName( ICON_BASE + "field", PNG_EXTENSION, modifiers ) ); break; case PARAMETER: case CONSTANT: - img = ImageUtilities.loadImage(getIconName(ICON_BASE + "constant", PNG_EXTENSION, modifiers)); // NOI18N - if (img == null) { - img = ImageUtilities.loadImage(ICON_BASE + "constantPublic" + PNG_EXTENSION); // NOI18N + icon = ImageUtilities.loadIcon(getIconName(ICON_BASE + "constant", PNG_EXTENSION, modifiers)); // NOI18N + if (icon == null) { + icon = ImageUtilities.loadIcon(ICON_BASE + "constantPublic" + PNG_EXTENSION); // NOI18N } break; case CONSTRUCTOR: - img = ImageUtilities.loadImage( getIconName( ICON_BASE + "constructor", PNG_EXTENSION, modifiers ) ); + icon = ImageUtilities.loadIcon( getIconName( ICON_BASE + "constructor", PNG_EXTENSION, modifiers ) ); break; case METHOD: - img = ImageUtilities.loadImage( getIconName( ICON_BASE + "method", PNG_EXTENSION, modifiers ) ); + icon = ImageUtilities.loadIcon( getIconName( ICON_BASE + "method", PNG_EXTENSION, modifiers ) ); break; case DB: - img = ImageUtilities.loadImage(ICON_BASE + "database" + GIF_EXTENSION); + icon = ImageUtilities.loadIcon(ICON_BASE + "database" + GIF_EXTENSION); break; default: - img = null; + icon = null; } - return img == null ? null : new ImageIcon (img); + return icon == null ? null : ImageUtilities.icon2ImageIcon (icon); } // Private Methods --------------------------------------------------------- diff --git a/ide/css.prep/src/org/netbeans/modules/css/prep/editor/CPCategoryStructureItem.java b/ide/css.prep/src/org/netbeans/modules/css/prep/editor/CPCategoryStructureItem.java index e231a1d50b4c..52b24edb23e4 100644 --- a/ide/css.prep/src/org/netbeans/modules/css/prep/editor/CPCategoryStructureItem.java +++ b/ide/css.prep/src/org/netbeans/modules/css/prep/editor/CPCategoryStructureItem.java @@ -136,7 +136,7 @@ public List getNestedItems() { @NbBundle.Messages("navigator.item.name.variables=Variables") public static class Variables extends ChildrenSetStructureItem { - private static final ImageIcon ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/css/prep/editor/resources/variables.gif")); //NOI18N + private static final ImageIcon ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/css/prep/editor/resources/variables.gif", false); //NOI18N public Variables(Set children, FeatureContext context) { super(new DummyElementHandle(context.getFileObject(), Bundle.navigator_item_name_variables()), children); @@ -151,7 +151,7 @@ public ImageIcon getCustomIcon() { @NbBundle.Messages("navigator.item.name.mixins=Mixins") public static class Mixins extends ChildrenSetStructureItem { - private static final ImageIcon ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/css/prep/editor/resources/methods.gif")); //NOI18N + private static final ImageIcon ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/css/prep/editor/resources/methods.gif", false); //NOI18N private final FeatureContext context; diff --git a/ide/css.prep/src/org/netbeans/modules/css/prep/editor/VariableCompletionItem.java b/ide/css.prep/src/org/netbeans/modules/css/prep/editor/VariableCompletionItem.java index c57741bb7c62..85c727046c01 100644 --- a/ide/css.prep/src/org/netbeans/modules/css/prep/editor/VariableCompletionItem.java +++ b/ide/css.prep/src/org/netbeans/modules/css/prep/editor/VariableCompletionItem.java @@ -33,7 +33,7 @@ */ public class VariableCompletionItem extends CPCompletionItem { - private static final ImageIcon LOCAL_VAR_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/css/prep/editor/resources/localVariable.gif")); //NOI18N + private static final ImageIcon LOCAL_VAR_ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/css/prep/editor/resources/localVariable.gif", false); //NOI18N /** * diff --git a/ide/css.visual/src/org/netbeans/modules/css/visual/RuleEditorPanel.java b/ide/css.visual/src/org/netbeans/modules/css/visual/RuleEditorPanel.java index 13aafebbaedf..4f025461e880 100644 --- a/ide/css.visual/src/org/netbeans/modules/css/visual/RuleEditorPanel.java +++ b/ide/css.visual/src/org/netbeans/modules/css/visual/RuleEditorPanel.java @@ -115,8 +115,8 @@ public class RuleEditorPanel extends JPanel { static RequestProcessor RP = new RequestProcessor(CssCaretAwareSourceTask.class); - private static final Icon ERROR_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/css/visual/resources/error-glyph.gif")); //NOI18N - private static final Icon APPLIED_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/css/visual/resources/database.gif")); //NOI18N + private static final Icon ERROR_ICON = ImageUtilities.loadIcon("org/netbeans/modules/css/visual/resources/error-glyph.gif"); //NOI18N + private static final Icon APPLIED_ICON = ImageUtilities.loadIcon("org/netbeans/modules/css/visual/resources/database.gif"); //NOI18N private final JLabel errorLabel, appliedLabel; diff --git a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/ui/ConnectionStatusPanel.java b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/ui/ConnectionStatusPanel.java index 7d0c25c4f837..f6448da8ad81 100644 --- a/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/ui/ConnectionStatusPanel.java +++ b/ide/db.sql.visualeditor/src/org/netbeans/modules/db/sql/visualeditor/ui/ConnectionStatusPanel.java @@ -25,19 +25,14 @@ package org.netbeans.modules.db.sql.visualeditor.ui; import org.netbeans.modules.db.sql.visualeditor.Log; -import java.awt.Image; import java.awt.event.ActionListener; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; -import org.openide.NotifyDescriptor; import org.openide.DialogDisplayer; import org.openide.DialogDescriptor; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; -import org.openide.util.HelpCtx; -import org.openide.util.Utilities; /** * Shows the status of a connction in a dialog. * This just presentss the results of a testConnection(), it @@ -52,11 +47,9 @@ public class ConnectionStatusPanel extends javax.swing.JPanel { private JButton okButton = new JButton(NbBundle.getMessage(ConnectionStatusPanel.class, "OK")); // NOI18N - // private Image conGood = Utilities.loadImage("org/netbeans/modules/db/sql/visualeditor/resources/started.png"); // NOI18N - // private Image conFailed = Utilities.loadImage("org/netbeans/modules/db/sql/visualeditor/resources/disconnected.png"); // NOI18N - private Image conGood = ImageUtilities.loadImage("org/netbeans/modules/db/sql/visualeditor/resources/ok.gif"); // NOI18N - private Image conFailed = ImageUtilities.loadImage("org/netbeans/modules/db/sql/visualeditor/resources/error.gif"); // NOI18N - private Image conWarning = ImageUtilities.loadImage("org/netbeans/modules/db/sql/visualeditor/resources/warning.gif"); // NOI18N + private Icon conGood = ImageUtilities.loadIcon("org/netbeans/modules/db/sql/visualeditor/resources/ok.gif"); // NOI18N + private Icon conFailed = ImageUtilities.loadIcon("org/netbeans/modules/db/sql/visualeditor/resources/error.gif"); // NOI18N + private Icon conWarning = ImageUtilities.loadIcon("org/netbeans/modules/db/sql/visualeditor/resources/warning.gif"); // NOI18N /** Creates new form ConnectionStatusDialog */ public ConnectionStatusPanel() { initComponents(); @@ -127,28 +120,28 @@ public void configureDisplay( String dsName, boolean connected, String sqlExcept /* calculate the displayd values based on this method's input parameters. */ if ( connected ) { - connectionStatusIcon.setIcon( new ImageIcon(conGood) ) ; + connectionStatusIcon.setIcon( conGood ) ; connectionStatusText.setText(getMsg("ConStat_succeeded_msg")) ; // NOI18N connectionStatusMessage.setVisible(false) ; validationInfo.setVisible(true) ; if ( sqlException == null ) { valStatusText.setText(getMsg("ConStat_rows_selected_msg", tableName, Integer.valueOf(rows)) ) ; // NOI18N - valStatusIcon.setIcon( new ImageIcon(conGood) ) ; + valStatusIcon.setIcon( conGood ) ; String valMsg ; if (rows > 1 ) { valMsg = getMsg("ConStat_valtable_bad_msg") ;// NOI18N - valStatusMessageIcon.setIcon( new ImageIcon(conWarning) ) ; + valStatusMessageIcon.setIcon( conWarning ) ; } else { valMsg = getMsg("ConStat_valtable_good_msg") ;// NOI18N - valStatusMessageIcon.setIcon( new ImageIcon(conGood) ) ; + valStatusMessageIcon.setIcon( conGood ) ; } valMsg = valMsg + "\n" + getMsg("ConStat_validationTableInfo") ; // NOI18N valStatusMessage.setText(valMsg) ; } else if (tableName != null) { // validation table test failed. - valStatusIcon.setIcon( new ImageIcon(conFailed) ) ; + valStatusIcon.setIcon( conFailed ) ; // validation failed. valStatusText.setText(getMsg("ConStat_failed_msg")) ;// NOI18N @@ -168,7 +161,7 @@ public void configureDisplay( String dsName, boolean connected, String sqlExcept } } else { // connection failed. - connectionStatusIcon.setIcon( new ImageIcon(conFailed) ) ; + connectionStatusIcon.setIcon( conFailed ) ; connectionStatusText.setText(getMsg("ConStat_failed_msg")) ;// NOI18N connectionStatusMessage.setText(sqlException) ; validationInfo.setVisible(false) ; diff --git a/ide/diff/src/org/netbeans/modules/merge/builtin/visualizer/MergePanel.java b/ide/diff/src/org/netbeans/modules/merge/builtin/visualizer/MergePanel.java index 9eca85afcabe..3d7b77a2fb2a 100644 --- a/ide/diff/src/org/netbeans/modules/merge/builtin/visualizer/MergePanel.java +++ b/ide/diff/src/org/netbeans/modules/merge/builtin/visualizer/MergePanel.java @@ -118,8 +118,6 @@ public MergePanel() { lastConflictButton.setVisible(false); prevConflictButton.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/diff/builtin/visualizer/prev.gif", true)); nextConflictButton.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/diff/builtin/visualizer/next.gif", true)); - //prevConflictButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/diff/builtin/visualizer/prev.gif"))); - //nextConflictButton.setIcon(new ImageIcon(getClass().getResource("/org/netbeans/modules/diff/builtin/visualizer/next.gif"))); //setTitle(org.openide.util.NbBundle.getBundle(DiffComponent.class).getString("DiffComponent.title")); //setName(org.openide.util.NbBundle.getMessage(MergePanel.class, "MergePanel.title")); //HelpCtx.setHelpIDString (getRootPane (), DiffComponent.class.getName ()); diff --git a/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageReportTopComponent.java b/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageReportTopComponent.java index 6888b991665d..cd4ec072d8e4 100644 --- a/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageReportTopComponent.java +++ b/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageReportTopComponent.java @@ -33,7 +33,6 @@ import java.util.Collections; import java.util.List; import javax.swing.GroupLayout.Alignment; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JScrollPane; @@ -60,6 +59,7 @@ import org.openide.loaders.DataObjectNotFoundException; import org.openide.nodes.Node; import org.openide.util.Exceptions; +import org.openide.util.ImageUtilities; import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.windows.TopComponent; @@ -548,7 +548,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, DataObject dobj = DataObject.find(file); Node node = dobj.getNodeDelegate(); Image icon = node.getIcon(BeanInfo.ICON_COLOR_32x32); - setIcon(new ImageIcon(icon)); + setIcon(ImageUtilities.image2Icon(icon)); } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); } diff --git a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java index 73b1acfff732..808948a8a124 100644 --- a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java +++ b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java @@ -85,10 +85,10 @@ public final class StatisticsPanel extends JPanel { private static final Icon alwaysOpenNewTabIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/gsf/testrunner/resources/newTab.png", true); private static final Icon rerunIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/gsf/testrunner/resources/rerun.png", true); - private static final Icon rerunFailedIcon = ImageUtilities.image2Icon(ImageUtilities.mergeImages( - ImageUtilities.loadImage("org/netbeans/modules/gsf/testrunner/resources/rerun.png"), //NOI18N - ImageUtilities.loadImage("org/netbeans/modules/gsf/testrunner/resources/error-badge.gif"), //NOI18N - 8, 8)); + private static final Icon rerunFailedIcon = ImageUtilities.mergeIcons( + ImageUtilities.loadIcon("org/netbeans/modules/gsf/testrunner/resources/rerun.png"), //NOI18N + ImageUtilities.loadIcon("org/netbeans/modules/gsf/testrunner/resources/error-badge.gif"), //NOI18N + 8, 8); private static final boolean isMacLaf = "Aqua".equals(UIManager.getLookAndFeel().getID()); private static final Color macBackground = UIManager.getColor("NbExplorerView.background"); diff --git a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/api/Manager.java b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/api/Manager.java index 513ee4301a55..0389de264ebf 100644 --- a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/api/Manager.java +++ b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/api/Manager.java @@ -419,7 +419,7 @@ public void run() { if (window.isOpened() && !isInSlidingMode) { window.promote(); } else if (!window.isOpened() || (window.isOpened() && !window.isShowing() && isInSlidingMode)) { - Icon icon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/gsf/testrunner/ui/resources/testResults.png")); //NOI18N + Icon icon = ImageUtilities.loadIcon("org/netbeans/modules/gsf/testrunner/ui/resources/testResults.png"); //NOI18N String projectname = ProjectUtils.getInformation(session.getProject()).getDisplayName(); int total = displayHandler.getTotalTests(); String title = total == 0 ? Bundle.LBL_NotificationDisplayer_NoTestsExecuted_title(projectname) : Bundle.LBL_NotificationDisplayer_title(total, projectname); diff --git a/ide/jumpto/src/org/netbeans/modules/jumpto/file/FileDescription.java b/ide/jumpto/src/org/netbeans/modules/jumpto/file/FileDescription.java index b6140073e510..b7cc61785e8b 100644 --- a/ide/jumpto/src/org/netbeans/modules/jumpto/file/FileDescription.java +++ b/ide/jumpto/src/org/netbeans/modules/jumpto/file/FileDescription.java @@ -22,7 +22,6 @@ package org.netbeans.modules.jumpto.file; -import java.awt.Image; import java.beans.BeanInfo; import java.util.logging.Level; import java.util.logging.Logger; @@ -93,10 +92,12 @@ public Icon getIcon() { Icon res = icon; if (res == null) { final DataObject od = getDataObject(); - final Image img = od == null ? // #187973 - UNKNOWN_PROJECT_ICON.getImage() : - od.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16); - res = icon = new ImageIcon(img); + if (od == null) { // #187973 + res = UNKNOWN_PROJECT_ICON; + } else { + res = ImageUtilities.image2Icon(od.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); + } + icon = res; } return res; } diff --git a/ide/languages.toml/src/org/netbeans/modules/languages/toml/structure/TomlStructureItem.java b/ide/languages.toml/src/org/netbeans/modules/languages/toml/structure/TomlStructureItem.java index 48963d2fbdf1..bd9de0d789e2 100644 --- a/ide/languages.toml/src/org/netbeans/modules/languages/toml/structure/TomlStructureItem.java +++ b/ide/languages.toml/src/org/netbeans/modules/languages/toml/structure/TomlStructureItem.java @@ -121,7 +121,7 @@ public long getEndPosition() { @Override public ImageIcon getCustomIcon() { String iconBase = getIconBase(); - return new ImageIcon(ImageUtilities.loadImage(iconBase)); + return ImageUtilities.loadImageIcon(iconBase, false); } private String getIconBase() { diff --git a/ide/languages/src/org/netbeans/modules/languages/features/CompletionSupport.java b/ide/languages/src/org/netbeans/modules/languages/features/CompletionSupport.java index e4d1f50a8db1..b51f44a4496d 100644 --- a/ide/languages/src/org/netbeans/modules/languages/features/CompletionSupport.java +++ b/ide/languages/src/org/netbeans/modules/languages/features/CompletionSupport.java @@ -61,14 +61,13 @@ private static ImageIcon getCIcon (String resourceName) { if (resourceName == null) resourceName = "org/netbeans/modules/languages/resources/node.gif"; if (!icons.containsKey (resourceName)) { - Image image = ImageUtilities.loadImage (resourceName); - if (image == null) - image = ImageUtilities.loadImage ( - "org/netbeans/modules/languages/resources/node.gif" - ); + ImageIcon icon = ImageUtilities.loadImageIcon (resourceName, false); + if (icon == null) + icon = ImageUtilities.loadImageIcon ( + "org/netbeans/modules/languages/resources/node.gif", false); icons.put ( resourceName, - new ImageIcon (image) + icon ); } return icons.get (resourceName); diff --git a/ide/languages/src/org/netbeans/modules/languages/features/LanguagesNavigator.java b/ide/languages/src/org/netbeans/modules/languages/features/LanguagesNavigator.java index 22e7aef533ba..54df5e106be7 100644 --- a/ide/languages/src/org/netbeans/modules/languages/features/LanguagesNavigator.java +++ b/ide/languages/src/org/netbeans/modules/languages/features/LanguagesNavigator.java @@ -272,14 +272,13 @@ public Component getTreeCellRendererComponent ( private static Icon getCIcon (String resourceName) { if (resourceName == null) return null; if (!icons.containsKey (resourceName)) { - Image image = ImageUtilities.loadImage (resourceName); - if (image == null) - image = ImageUtilities.loadImage ( - "org/netbeans/modules/languages/resources/node.gif" - ); + ImageIcon icon = ImageUtilities.loadImageIcon (resourceName, false); + if (icon == null) + icon = ImageUtilities.loadImageIcon ( + "org/netbeans/modules/languages/resources/node.gif", false); icons.put ( resourceName, - new ImageIcon (image) + icon ); } return icons.get (resourceName); diff --git a/ide/localtasks/src/org/netbeans/modules/localtasks/task/TaskPanel.java b/ide/localtasks/src/org/netbeans/modules/localtasks/task/TaskPanel.java index 6009be8dc96e..e98d7a2c113e 100644 --- a/ide/localtasks/src/org/netbeans/modules/localtasks/task/TaskPanel.java +++ b/ide/localtasks/src/org/netbeans/modules/localtasks/task/TaskPanel.java @@ -927,7 +927,7 @@ private void updateMessagePanel () { JLabel noSummaryLabel = new JLabel(); noSummaryLabel.setText(Bundle.IssuePanel_noSummary()); String icon = "org/netbeans/modules/localtasks/resources/error.gif"; //NOI18N - noSummaryLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(icon))); + noSummaryLabel.setIcon(ImageUtilities.loadIcon(icon)); messagePanel.add(noSummaryLabel); } if (noSummary) { diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/Icons.java b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/Icons.java index eec1f85def3a..1ff755167198 100644 --- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/Icons.java +++ b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/Icons.java @@ -42,22 +42,21 @@ private Icons() { } public static Icon getCompletionIcon(CompletionItemKind completionKind) { - Image img = null; + Icon icon = null; if (completionKind != null) { - img = ImageUtilities.loadImage(ICON_BASE + completionKind.name().toLowerCase(Locale.US) + PNG_EXTENSION); + icon = ImageUtilities.loadIcon(ICON_BASE + completionKind.name().toLowerCase(Locale.US) + PNG_EXTENSION); - if (img == null) { - img = ImageUtilities.loadImage(ICON_BASE + completionKind.name().toLowerCase(Locale.US) + GIF_EXTENSION); + if (icon == null) { + icon = ImageUtilities.loadIcon(ICON_BASE + completionKind.name().toLowerCase(Locale.US) + GIF_EXTENSION); } } - if (img == null) { - img = ImageUtilities.loadImage(ICON_BASE + "variable" + GIF_EXTENSION); + if (icon == null) { + icon = ImageUtilities.loadIcon(ICON_BASE + "variable" + GIF_EXTENSION); } - return img == null ? null : new ImageIcon (img); - + return icon; } public static String getSymbolIconBase(Enum symbolKind) { diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/refactoring/tree/FileTreeElement.java b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/refactoring/tree/FileTreeElement.java index 872b87f509ac..b3ff2e9f10fe 100644 --- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/refactoring/tree/FileTreeElement.java +++ b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/refactoring/tree/FileTreeElement.java @@ -33,6 +33,7 @@ import org.openide.text.Line; import org.openide.text.NbDocument; import org.openide.util.Exceptions; +import org.openide.util.ImageUtilities; /**Copied from refactoring.java, and simplified. * @@ -65,8 +66,7 @@ public TreeElement getParent(boolean isLogical) { @Override public Icon getIcon() { try { - ImageIcon imageIcon = new ImageIcon(DataObject.find(fo).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); - return imageIcon; + return ImageUtilities.image2Icon(DataObject.find(fo).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); } catch (DataObjectNotFoundException ex) { return null; } diff --git a/ide/notifications/test/unit/src/org/netbeans/modules/notifications/center/NotificationCenterManagerTest.java b/ide/notifications/test/unit/src/org/netbeans/modules/notifications/center/NotificationCenterManagerTest.java index 43cbe1674c88..077a87ae8fe4 100644 --- a/ide/notifications/test/unit/src/org/netbeans/modules/notifications/center/NotificationCenterManagerTest.java +++ b/ide/notifications/test/unit/src/org/netbeans/modules/notifications/center/NotificationCenterManagerTest.java @@ -141,7 +141,7 @@ private Notification createNotification() { private Notification createNotification(Category category, String title) { String dummyText = "The Netbeans IDE has detected that your system is using most of your available system resources. We recommend shutting down other applications and windows."; return NotificationDisplayerImpl.getInstance().notify(title, - new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/notifications/resources/filter.png")), + ImageUtilities.loadIcon("org/netbeans/modules/notifications/resources/filter.png"), new JLabel(dummyText), new JLabel(dummyText), NotificationDisplayer.Priority.NORMAL, category); diff --git a/ide/projectui/src/org/netbeans/modules/project/ui/ExitDialog.java b/ide/projectui/src/org/netbeans/modules/project/ui/ExitDialog.java index e3bc7c620727..6cfc7eb7b977 100644 --- a/ide/projectui/src/org/netbeans/modules/project/ui/ExitDialog.java +++ b/ide/projectui/src/org/netbeans/modules/project/ui/ExitDialog.java @@ -46,6 +46,7 @@ import org.openide.cookies.SaveCookie; import org.openide.loaders.DataObject; import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; @@ -333,7 +334,7 @@ public void run() { Node node = obj.getNodeDelegate(); - ImageIcon icon = new ImageIcon(node.getIcon(BeanInfo.ICON_COLOR_16x16)); + Icon icon = ImageUtilities.image2Icon(node.getIcon(BeanInfo.ICON_COLOR_16x16)); super.setIcon(icon); setText(node.getDisplayName()); diff --git a/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/SpellcheckerOptionsPanel.java b/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/SpellcheckerOptionsPanel.java index a313449c4fe1..e189b28d0aae 100644 --- a/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/SpellcheckerOptionsPanel.java +++ b/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/SpellcheckerOptionsPanel.java @@ -83,7 +83,7 @@ public class SpellcheckerOptionsPanel extends javax.swing.JPanel { private List addedDictionaries = new ArrayList(); private SpellcheckerOptionsPanelController c; - private static final Icon errorIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/spellchecker/resources/error.gif")); + private static final Icon errorIcon = ImageUtilities.loadIcon("org/netbeans/modules/spellchecker/resources/error.gif"); /** * Creates new form SpellcheckerOptionsPanel diff --git a/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/ViewModelListener.java b/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/ViewModelListener.java index 96117cd32d8d..32d835714b04 100644 --- a/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/ViewModelListener.java +++ b/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/ViewModelListener.java @@ -38,7 +38,6 @@ import java.util.prefs.PreferenceChangeListener; import java.util.prefs.Preferences; import javax.swing.AbstractButton; -import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.SwingConstants; @@ -83,6 +82,7 @@ import org.netbeans.spi.viewmodel.TreeModelFilter; import org.netbeans.spi.viewmodel.UnknownTypeException; import org.openide.util.Exceptions; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; import org.openide.util.NbPreferences; import org.openide.util.RequestProcessor; @@ -770,7 +770,7 @@ public void run() { private javax.swing.JButton createSessionsSwitchButton() { final javax.swing.JButton b = VariablesViewButtons.createButton( - new ImageIcon(viewIcon), + ImageUtilities.image2Icon(viewIcon), NbBundle.getMessage(ViewModelListener.class, "Tooltip_SelectSrc")); b.addActionListener(new ActionListener() { @Override diff --git a/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/debugging/InfoPanel.java b/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/debugging/InfoPanel.java index fe99038c08fe..b36d944ae763 100644 --- a/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/debugging/InfoPanel.java +++ b/ide/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/views/debugging/InfoPanel.java @@ -31,13 +31,11 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.ref.WeakReference; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.WeakHashMap; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JMenuItem; @@ -51,7 +49,6 @@ import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import org.netbeans.api.debugger.Breakpoint; -import org.netbeans.api.debugger.DebuggerManager; import org.netbeans.api.debugger.Session; import org.netbeans.spi.debugger.ui.DebuggingView.DVSupport; import org.netbeans.spi.debugger.ui.DebuggingView.DVThread; @@ -60,7 +57,6 @@ import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; -import org.openide.util.Utilities; /** * @@ -213,7 +209,7 @@ public void run() { private JMenuItem createMenuItem(final DVSupport dvs, final DVThread thread) { String displayName = dvs.getDisplayName(thread); Image image = dvs.getIcon(thread); - Icon icon = image != null ? new ImageIcon(image) : null; + Icon icon = image != null ? ImageUtilities.image2Icon(image) : null; JMenuItem item = new JMenuItem(displayName, icon); item.addActionListener(new ActionListener() { diff --git a/ide/spi.palette/src/org/netbeans/modules/palette/ui/CategoryList.java b/ide/spi.palette/src/org/netbeans/modules/palette/ui/CategoryList.java index e69d3fe6b77a..3864038c0512 100644 --- a/ide/spi.palette/src/org/netbeans/modules/palette/ui/CategoryList.java +++ b/ide/spi.palette/src/org/netbeans/modules/palette/ui/CategoryList.java @@ -25,7 +25,6 @@ import java.awt.Component; import java.awt.Container; import java.awt.FocusTraversalPolicy; -import java.awt.Font; import java.awt.Image; import java.awt.Insets; import java.awt.KeyboardFocusManager; @@ -41,10 +40,8 @@ import javax.swing.Action; import javax.swing.ActionMap; import javax.swing.BorderFactory; -import javax.swing.ImageIcon; import javax.swing.InputMap; import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPopupMenu; import javax.swing.JToggleButton; @@ -63,6 +60,7 @@ import org.netbeans.modules.palette.Item; import org.netbeans.modules.palette.Utils; import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; import org.openide.util.Utilities; /** @@ -298,7 +296,7 @@ public Component getListCellRendererComponent (JList list, Item item = (Item) value; Image icon = item.getIcon (iconSize); if (icon != null) { - button.setIcon (new ImageIcon (icon)); + button.setIcon (ImageUtilities.image2Icon(icon)); } button.setText (showNames ? item.getDisplayName () : null); diff --git a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/ScopeButton.java b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/ScopeButton.java index 029d5b7c9229..275fac548095 100644 --- a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/ScopeButton.java +++ b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/ScopeButton.java @@ -22,12 +22,12 @@ import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.ImageIcon; import javax.swing.JToggleButton; import javax.swing.ToolTipManager; import org.netbeans.modules.tasklist.impl.Accessor; import org.netbeans.modules.tasklist.impl.TaskManagerImpl; import org.netbeans.spi.tasklist.TaskScanningScope; +import org.openide.util.ImageUtilities; /** * @@ -43,7 +43,7 @@ public ScopeButton( TaskManagerImpl tm, TaskScanningScope scope ) { this.tm = tm; this.scope = scope; setText( null ); - setIcon( new ImageIcon( Accessor.getIcon( scope ) ) ); + setIcon( ImageUtilities.image2Icon( Accessor.getIcon( scope ) ) ); ToolTipManager.sharedInstance().registerComponent(this); setFocusable( false ); } diff --git a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/TaskListTable.java b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/TaskListTable.java index 516dcacc5fa1..f7809d120cb8 100644 --- a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/TaskListTable.java +++ b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/TaskListTable.java @@ -334,7 +334,7 @@ void setAscendingSort( boolean asc ) { private static final Icon openedIcon = (Icon)UIManager.get("Tree.expandedIcon"); // NOI18N private static final Icon closedIcon = (Icon)UIManager.get("Tree.collapsedIcon"); // NOI18N - private static Map iconCache = new HashMap(10); + private static Map iconCache = new HashMap(10); private class TaskGroupRenderer extends DefaultTableCellRenderer { @@ -347,9 +347,9 @@ public Component getTableCellRendererComponent(JTable table, Object value, TaskGroup tg = (TaskGroup)value; JLabel renderer = (JLabel)res; renderer.setText( null ); - ImageIcon icon = iconCache.get( tg.getIcon() ); + Icon icon = iconCache.get( tg.getIcon() ); if( null == icon ) { - icon = new ImageIcon( tg.getIcon() ); + icon = ImageUtilities.image2Icon( tg.getIcon() ); iconCache.put( tg.getIcon(), icon ); } renderer.setIcon( icon ); diff --git a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/Util.java b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/Util.java index 5140d34c705d..3de202bd7dd8 100644 --- a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/Util.java +++ b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/ui/Util.java @@ -23,13 +23,13 @@ import javax.swing.AbstractAction; import org.netbeans.modules.tasklist.impl.*; import javax.swing.Action; -import javax.swing.ImageIcon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenu; import javax.swing.JPopupMenu; import javax.swing.JRadioButtonMenuItem; import org.netbeans.spi.tasklist.Task; import org.netbeans.spi.tasklist.TaskScanningScope; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; /** @@ -118,7 +118,7 @@ private static JMenu createSortMenu( TaskListTable table ) { private static class SwitchScopeAction extends AbstractAction { private TaskScanningScope scope; public SwitchScopeAction( TaskScanningScope scope ) { - super( Accessor.getDisplayName( scope ), new ImageIcon( Accessor.getIcon( scope ) ) ); + super( Accessor.getDisplayName( scope ), ImageUtilities.image2Icon( Accessor.getIcon( scope ) ) ); this.scope = scope; } diff --git a/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/SaveQueryPanel.java b/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/SaveQueryPanel.java index 98cbd4b8e798..54994b3f5f01 100644 --- a/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/SaveQueryPanel.java +++ b/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/SaveQueryPanel.java @@ -26,8 +26,7 @@ package org.netbeans.modules.bugtracking.commons; import java.awt.Color; -import java.awt.Image; -import javax.swing.ImageIcon; +import javax.swing.Icon; import javax.swing.JButton; import javax.swing.UIManager; import javax.swing.event.DocumentEvent; @@ -61,8 +60,8 @@ private SaveQueryPanel() { queryNameTextField.getDocument().addDocumentListener(this); saveErrorLabel.setForeground(ERROR_COLOR); - Image img = ImageUtilities.loadImage("org/netbeans/modules/bugtracking/ui/resources/error.gif"); //NOI18N - saveErrorLabel.setIcon( new ImageIcon(img) ); + Icon icon = ImageUtilities.loadIcon("org/netbeans/modules/bugtracking/ui/resources/error.gif"); //NOI18N + saveErrorLabel.setIcon( icon ); saveErrorLabel.setVisible(false); } diff --git a/ide/team.commons/src/org/netbeans/modules/team/commons/treelist/AsynchronousNode.java b/ide/team.commons/src/org/netbeans/modules/team/commons/treelist/AsynchronousNode.java index 9da5a4ebae76..dee51fb2a8a0 100644 --- a/ide/team.commons/src/org/netbeans/modules/team/commons/treelist/AsynchronousNode.java +++ b/ide/team.commons/src/org/netbeans/modules/team/commons/treelist/AsynchronousNode.java @@ -22,7 +22,6 @@ import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; import java.awt.Insets; import java.awt.event.ActionEvent; import java.util.MissingResourceException; @@ -268,8 +267,8 @@ private JPanel getPanel() throws MissingResourceException { lblLoading.setForeground(ColorManager.getDefault().getDisabledColor()); lblError = new TreeLabel(NbBundle.getMessage(AsynchronousNode.class, "LBL_NotResponding")); //NOI18N lblError.setForeground(ColorManager.getDefault().getErrorColor()); - Image img = ImageUtilities.loadImage("org/netbeans/modules/team/commons/resources/error.png"); //NOI18N - lblError.setIcon(new ImageIcon(img)); + Icon icon = ImageUtilities.loadIcon("org/netbeans/modules/team/commons/resources/error.png"); //NOI18N + lblError.setIcon(icon); lblFill = new JLabel(); btnRetry = new LinkButton(NbBundle.getMessage(AsynchronousNode.class, "LBL_Retry"), new AbstractAction() { //NOI18N @Override diff --git a/ide/utilities/src/org/netbeans/modules/openfile/RecentFiles.java b/ide/utilities/src/org/netbeans/modules/openfile/RecentFiles.java index c00c6ae34b5d..bc8283ca1fc2 100644 --- a/ide/utilities/src/org/netbeans/modules/openfile/RecentFiles.java +++ b/ide/utilities/src/org/netbeans/modules/openfile/RecentFiles.java @@ -305,7 +305,7 @@ private static Icon findIconForPath(String path) { } i = dObj == null ? null - : new ImageIcon(dObj.getNodeDelegate().getIcon( + : ImageUtilities.image2Icon(dObj.getNodeDelegate().getIcon( BeanInfo.ICON_COLOR_16x16)); } return i; diff --git a/ide/utilities/src/org/netbeans/modules/url/URLPresenter.java b/ide/utilities/src/org/netbeans/modules/url/URLPresenter.java index eeb215b2fc62..651392adba33 100644 --- a/ide/utilities/src/org/netbeans/modules/url/URLPresenter.java +++ b/ide/utilities/src/org/netbeans/modules/url/URLPresenter.java @@ -27,20 +27,17 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.AbstractButton; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JMenuItem; import org.openide.awt.Mnemonics; import org.openide.cookies.OpenCookie; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; -import org.openide.filesystems.FileSystem; import org.openide.filesystems.FileUIUtils; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.util.HelpCtx; import org.openide.util.ImageUtilities; -import org.openide.util.Utilities; import org.openide.util.WeakListeners; import org.openide.util.actions.Presenter; @@ -108,7 +105,7 @@ private void initialize(AbstractButton presenter, boolean useIcons) { } catch (FileStateInvalidException fsie) { // OK, so we use the default icon } - presenter.setIcon(new ImageIcon(icon)); + presenter.setIcon(ImageUtilities.image2Icon(icon)); } /* set the presenter's text and ensure it is maintained up-to-date: */ diff --git a/ide/versioning.util/src/org/netbeans/modules/versioning/util/common/FileTreeView.java b/ide/versioning.util/src/org/netbeans/modules/versioning/util/common/FileTreeView.java index 1417ecb517fb..aac0ec7a9599 100644 --- a/ide/versioning.util/src/org/netbeans/modules/versioning/util/common/FileTreeView.java +++ b/ide/versioning.util/src/org/netbeans/modules/versioning/util/common/FileTreeView.java @@ -50,7 +50,6 @@ import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JPopupMenu; @@ -680,7 +679,7 @@ public String getTooltipText (Object o) { @Override public Icon getIcon (Object o) { Node n = Visualizer.findNode(o); - return new ImageIcon(n.getIcon(java.beans.BeanInfo.ICON_COLOR_16x16)); + return ImageUtilities.image2Icon(n.getIcon(java.beans.BeanInfo.ICON_COLOR_16x16)); } private boolean isModified (T node) { diff --git a/ide/xml.schema.completion/src/org/netbeans/modules/xml/schema/completion/CompletionQuery.java b/ide/xml.schema.completion/src/org/netbeans/modules/xml/schema/completion/CompletionQuery.java index 2f73cc726b48..68f488301d16 100644 --- a/ide/xml.schema.completion/src/org/netbeans/modules/xml/schema/completion/CompletionQuery.java +++ b/ide/xml.schema.completion/src/org/netbeans/modules/xml/schema/completion/CompletionQuery.java @@ -381,8 +381,8 @@ List getCompletionItems(Document doc, int caretOffset) { private FileObject primaryFile; private CompletionContextImpl context; - private static final ImageIcon LOADING_ICON = new ImageIcon(ImageUtilities.loadImage( - "org/netbeans/modules/xml/schema/completion/resources/element.png")); // NOI18N + private static final ImageIcon LOADING_ICON = ImageUtilities.loadImageIcon( + "org/netbeans/modules/xml/schema/completion/resources/element.png", false); // NOI18N private static final class FinishDownloadItem implements CompletionItem { @Override diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/navigator/NavigatorTreeCellRenderer.java b/ide/xml.text/src/org/netbeans/modules/xml/text/navigator/NavigatorTreeCellRenderer.java index 8997ce7f9a72..232721a7ae51 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/navigator/NavigatorTreeCellRenderer.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/navigator/NavigatorTreeCellRenderer.java @@ -19,9 +19,7 @@ package org.netbeans.modules.xml.text.navigator; import java.awt.Component; -import java.awt.Image; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; @@ -45,12 +43,12 @@ public class NavigatorTreeCellRenderer extends DefaultTreeCellRenderer { private static final String ERROR_16 = "org/netbeans/modules/xml/text/navigator/resources/badge_error.png"; - private final Image ERROR_IMAGE = ImageUtilities.loadImage(ERROR_16, true); + private final Icon ERROR_ICON = ImageUtilities.loadIcon(ERROR_16, true); - private final Icon[] TAG_ICON = new Icon[]{getImageIcon(TAG_16, false), getImageIcon(TAG_16, true)}; - private final Icon[] PI_ICON = new Icon[]{getImageIcon(PI_16, false), getImageIcon(PI_16, true)}; - private final Icon[] DOCTYPE_ICON = new Icon[]{getImageIcon(DOCTYPE_16, false), getImageIcon(DOCTYPE_16, true)}; - private final Icon[] CDATA_ICON = new Icon[]{getImageIcon(CDATA_16, false), getImageIcon(CDATA_16, true)}; + private final Icon[] TAG_ICON = new Icon[]{getIcon(TAG_16, false), getIcon(TAG_16, true)}; + private final Icon[] PI_ICON = new Icon[]{getIcon(PI_16, false), getIcon(PI_16, true)}; + private final Icon[] DOCTYPE_ICON = new Icon[]{getIcon(DOCTYPE_16, false), getIcon(DOCTYPE_16, true)}; + private final Icon[] CDATA_ICON = new Icon[]{getIcon(CDATA_16, false), getIcon(CDATA_16, true)}; private HtmlRenderer.Renderer renderer; @@ -91,12 +89,13 @@ public void setIcon(Icon[] icons, boolean containsError) { renderer.setIcon(icons[containsError ? 1 : 0]); } - private ImageIcon getImageIcon(String name, boolean error){ - ImageIcon icon = ImageUtilities.loadImageIcon(name, false); - if(error) - return new ImageIcon(ImageUtilities.mergeImages( icon.getImage(), ERROR_IMAGE, 15, 7 )); - else + private Icon getIcon(String name, boolean error){ + Icon icon = ImageUtilities.loadIcon(name); + if (error) { + return ImageUtilities.mergeIcons(icon, ERROR_ICON, 15, 7); + } else { return icon; + } } } diff --git a/java/form/src/org/netbeans/modules/form/FormToolBar.java b/java/form/src/org/netbeans/modules/form/FormToolBar.java index a83c2b59655c..a1df40c42568 100644 --- a/java/form/src/org/netbeans/modules/form/FormToolBar.java +++ b/java/form/src/org/netbeans/modules/form/FormToolBar.java @@ -82,7 +82,7 @@ public FormToolBar(FormDesigner designer, JToolBar toolbar) { listener = new Listener(); // selection button - selectionButton = new JToggleButton(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/form/resources/selection_mode.png", true)), // NOI18N + selectionButton = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/form/resources/selection_mode.png", true), // NOI18N false); selectionButton.addActionListener(listener); selectionButton.addMouseListener(listener); @@ -93,7 +93,7 @@ public FormToolBar(FormDesigner designer, JToolBar toolbar) { initButton(selectionButton); // connection button - connectionButton = new JToggleButton(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/form/resources/connection_mode.png", true)), // NOI18N + connectionButton = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/form/resources/connection_mode.png", true), // NOI18N false); connectionButton.addActionListener(listener); connectionButton.addMouseListener(listener); @@ -213,7 +213,7 @@ void updateDesignerMode(int mode) { PaletteItem item = PaletteUtils.getSelectedItem(); if (item != null && mode == FormDesigner.MODE_ADD) { addLabel.setIcon( - new ImageIcon(item.getNode().getIcon(BeanInfo.ICON_COLOR_16x16))); + ImageUtilities.image2Icon(item.getNode().getIcon(BeanInfo.ICON_COLOR_16x16))); addLabel.setText(item.getNode().getDisplayName()); } else { diff --git a/java/form/src/org/netbeans/modules/form/HandleLayer.java b/java/form/src/org/netbeans/modules/form/HandleLayer.java index be32bcf65a57..bc7ae6cf4c78 100644 --- a/java/form/src/org/netbeans/modules/form/HandleLayer.java +++ b/java/form/src/org/netbeans/modules/form/HandleLayer.java @@ -3410,7 +3410,7 @@ void init() { // can be re-inited } else { icon = node.getIcon(java.beans.BeanInfo.ICON_COLOR_16x16); } - showingComponents[0] = new JLabel(new ImageIcon(icon)); + showingComponents[0] = new JLabel(ImageUtilities.image2Icon(icon)); Dimension dim = showingComponents[0].getPreferredSize(); hotSpot = new Point(dim.width/2, dim.height/2); if (hotSpot.x < 0) { diff --git a/java/form/src/org/netbeans/modules/form/NonVisualTray.java b/java/form/src/org/netbeans/modules/form/NonVisualTray.java index b2c906725fe4..44362409d768 100644 --- a/java/form/src/org/netbeans/modules/form/NonVisualTray.java +++ b/java/form/src/org/netbeans/modules/form/NonVisualTray.java @@ -28,6 +28,7 @@ import org.openide.actions.*; import org.openide.explorer.*; import org.openide.explorer.view.*; +import org.openide.util.ImageUtilities; /** * A component that displays non visual beans. @@ -141,7 +142,7 @@ public Renderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Node node = Visualizer.findNode(value); - ImageIcon icon = new ImageIcon(node.getIcon(java.beans.BeanInfo.ICON_COLOR_32x32)); + Icon icon = ImageUtilities.image2Icon(node.getIcon(java.beans.BeanInfo.ICON_COLOR_32x32)); button.setIcon(icon); String text = node.getShortDescription(); button.setText(text); diff --git a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java index e17674c2625b..e74c7b5009af 100644 --- a/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java +++ b/java/gradle.java/src/org/netbeans/modules/gradle/java/customizer/SourceSetPanel.java @@ -68,7 +68,7 @@ public String toString() { private static final String PROJECT_ICON = "org.netbeans.modules/gradle/resources/gradle.png"; //NOI18N private static final String ARTIFACT_ICON = "org.netbeans.modules/gradle/resources/module-artifact.png"; //NOI18N - final Icon folderIcon = new ImageIcon(NodeUtils.getTreeFolderIcon(false)); + final Icon folderIcon = ImageUtilities.image2Icon(NodeUtils.getTreeFolderIcon(false)); final Icon projectIcon = ImageUtilities.loadImageIcon(PROJECT_ICON, false); final Icon artifactIcon = ImageUtilities.loadImageIcon(ARTIFACT_ICON, false); diff --git a/java/i18n/src/org/netbeans/modules/i18n/wizard/ResourceWizardPanel.java b/java/i18n/src/org/netbeans/modules/i18n/wizard/ResourceWizardPanel.java index c4053c900bdb..d6af90238c4a 100644 --- a/java/i18n/src/org/netbeans/modules/i18n/wizard/ResourceWizardPanel.java +++ b/java/i18n/src/org/netbeans/modules/i18n/wizard/ResourceWizardPanel.java @@ -56,6 +56,7 @@ import org.openide.WizardValidationException; import org.openide.loaders.DataObject; +import org.openide.util.ImageUtilities; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.filesystems.FileObject; @@ -154,7 +155,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, } label.setText(name); // NOI18N - label.setIcon(new ImageIcon(dataObject.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16))); + label.setIcon(ImageUtilities.image2Icon(dataObject.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16))); } else { label.setText(""); // NOI18N label.setIcon(null); diff --git a/java/i18n/src/org/netbeans/modules/i18n/wizard/SourceWizardPanel.java b/java/i18n/src/org/netbeans/modules/i18n/wizard/SourceWizardPanel.java index 9f8e1175b47b..20f0a30fecfb 100644 --- a/java/i18n/src/org/netbeans/modules/i18n/wizard/SourceWizardPanel.java +++ b/java/i18n/src/org/netbeans/modules/i18n/wizard/SourceWizardPanel.java @@ -50,6 +50,7 @@ import org.openide.nodes.NodeOperation; import org.openide.util.HelpCtx; import org.openide.util.UserCancelException; +import org.openide.util.ImageUtilities; import org.netbeans.modules.i18n.SelectorUtils; import org.openide.WizardDescriptor; @@ -313,7 +314,7 @@ public Component getListCellRendererComponent( } else { label.setText(cp.getResourceName(dataObject.getPrimaryFile(), '.', false )); // NOI18N } - label.setIcon(new ImageIcon(dataObject.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16))); + label.setIcon(ImageUtilities.image2Icon(dataObject.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16))); } else { label.setText(""); // NOI18N label.setIcon(null); diff --git a/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/completion/CCPaintComponent.java b/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/completion/CCPaintComponent.java index 051d2c665059..d3d21645ca46 100644 --- a/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/completion/CCPaintComponent.java +++ b/java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/completion/CCPaintComponent.java @@ -31,7 +31,6 @@ import java.util.Map; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JPanel; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; @@ -317,7 +316,7 @@ public void setContent(String columnName, String tableName) { @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(COLUMN_ICON))); + drawIcon(g, ImageUtilities.loadIcon(COLUMN_ICON)); drawString(g, tableName+".", Color.BLACK); drawString(g, columnName, Color.BLACK, getDrawFont().deriveFont(Font.BOLD), false); } @@ -334,7 +333,7 @@ public void setContent(String tableName) { @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(TABLE_ICON))); + drawIcon(g, ImageUtilities.loadIcon(TABLE_ICON)); drawString(g, tableName, Color.BLACK, getDrawFont().deriveFont(Font.BOLD), false); } @@ -350,7 +349,7 @@ public void setContent(String puName) { @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(PU_ICON))); + drawIcon(g, ImageUtilities.loadIcon(PU_ICON)); drawString(g, puName, Color.BLACK, getDrawFont().deriveFont(Font.BOLD), false); } @@ -365,7 +364,7 @@ public void setContent(String puName) { @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(PU_ICON))); + drawIcon(g, ImageUtilities.loadIcon(PU_ICON)); drawString(g, puName, Color.BLACK, getDrawFont().deriveFont(Font.BOLD), false); } @@ -381,7 +380,7 @@ public void setContent(String elName) { @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(PU_ICON))); + drawIcon(g, ImageUtilities.loadIcon(PU_ICON)); drawString(g, elName, Color.BLACK, getDrawFont().deriveFont(Font.BOLD), false); } @@ -391,7 +390,7 @@ public static final class NoConnectionItemPaintComponent extends NbStringPaintCo @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(NOCONNECTION_ICON))); + drawIcon(g, ImageUtilities.loadIcon(NOCONNECTION_ICON)); drawString(g, NbBundle.getMessage(CCPaintComponent.class, "LBL_ConnectToDatabase"), Color.RED, getDrawFont().deriveFont(Font.BOLD), false); } @@ -400,7 +399,7 @@ public static final class AddConnectionItemPaintComponent extends NbStringPaintC @Override protected void draw(Graphics g){ - drawIcon(g, new ImageIcon(ImageUtilities.loadImage(CONNECTION_ICON))); + drawIcon(g, ImageUtilities.loadIcon(CONNECTION_ICON)); drawString(g, NbBundle.getMessage(CCPaintComponent.class, "LBL_AddConnection"), Color.BLACK, getDrawFont().deriveFont(Font.BOLD), false); } diff --git a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/LibrariesNode.java b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/LibrariesNode.java index 9ce42088a0e6..d2508814f1de 100644 --- a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/LibrariesNode.java +++ b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/LibrariesNode.java @@ -559,8 +559,8 @@ public static Action createAddFolderAction (AntProjectHelper p, SourceRoots sour static synchronized Icon getFolderIcon (boolean opened) { if (openedFolderIconCache == null) { Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate(); - openedFolderIconCache = new ImageIcon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); - folderIconCache = new ImageIcon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); + openedFolderIconCache = ImageUtilities.image2Icon(n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)); + folderIconCache = ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16)); } if (opened) { return openedFolderIconCache; diff --git a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/ClassPathListCellRenderer.java b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/ClassPathListCellRenderer.java index f0b0f9551519..ebcadf4bfe61 100644 --- a/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/ClassPathListCellRenderer.java +++ b/java/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/ClassPathListCellRenderer.java @@ -29,7 +29,6 @@ import java.util.regex.Pattern; import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.JTable; import javax.swing.JTree; @@ -66,11 +65,10 @@ public class ClassPathListCellRenderer extends DefaultListCellRenderer { private static final Pattern FOREIGN_PLAIN_FILE_REFERENCE = Pattern.compile("\\$\\{file\\.reference\\.([^${}]+)\\}"); // NOI18N private static final Pattern UNKNOWN_FILE_REFERENCE = Pattern.compile("\\$\\{([^${}]+)\\}"); // NOI18N - private static ImageIcon ICON_FOLDER = null; - - private static ImageIcon ICON_BROKEN_JAR; - private static ImageIcon ICON_BROKEN_LIBRARY; - private static ImageIcon ICON_BROKEN_ARTIFACT; + private static Icon ICON_FOLDER = null; + private static Icon ICON_BROKEN_JAR; + private static Icon ICON_BROKEN_LIBRARY; + private static Icon ICON_BROKEN_ARTIFACT; private PropertyEvaluator evaluator; private FileObject projectFolder; @@ -199,7 +197,7 @@ static Icon getIcon( ClassPathSupport.Item item ) { case ClassPathSupport.Item.TYPE_LIBRARY: if ( item.isBroken() ) { if ( ICON_BROKEN_LIBRARY == null ) { - ICON_BROKEN_LIBRARY = new ImageIcon( ImageUtilities.mergeImages( ProjectProperties.ICON_LIBRARY.getImage(), ProjectProperties.ICON_BROKEN_BADGE.getImage(), 7, 7 ) ); + ICON_BROKEN_LIBRARY = ImageUtilities.mergeIcons( ProjectProperties.ICON_LIBRARY, ProjectProperties.ICON_BROKEN_BADGE, 7, 7 ); } return ICON_BROKEN_LIBRARY; } @@ -209,7 +207,7 @@ static Icon getIcon( ClassPathSupport.Item item ) { case ClassPathSupport.Item.TYPE_ARTIFACT: if ( item.isBroken() ) { if ( ICON_BROKEN_ARTIFACT == null ) { - ICON_BROKEN_ARTIFACT = new ImageIcon( ImageUtilities.mergeImages( ProjectProperties.ICON_ARTIFACT.getImage(), ProjectProperties.ICON_BROKEN_BADGE.getImage(), 7, 7 ) ); + ICON_BROKEN_ARTIFACT = ImageUtilities.mergeIcons(ProjectProperties.ICON_ARTIFACT, ProjectProperties.ICON_BROKEN_BADGE, 7, 7 ); } return ICON_BROKEN_ARTIFACT; } @@ -224,18 +222,18 @@ static Icon getIcon( ClassPathSupport.Item item ) { case ClassPathSupport.Item.TYPE_JAR: if ( item.isBroken() ) { if ( ICON_BROKEN_JAR == null ) { - ICON_BROKEN_JAR = new ImageIcon( ImageUtilities.mergeImages( ProjectProperties.ICON_JAR.getImage(), ProjectProperties.ICON_BROKEN_BADGE.getImage(), 7, 7 ) ); + ICON_BROKEN_JAR = ImageUtilities.mergeIcons(ProjectProperties.ICON_JAR, ProjectProperties.ICON_BROKEN_BADGE, 7, 7); } return ICON_BROKEN_JAR; } else { File file = item.getResolvedFile(); - ImageIcon icn = file.isDirectory() ? getFolderIcon() : ProjectProperties.ICON_JAR; + Icon icn = file.isDirectory() ? getFolderIcon() : ProjectProperties.ICON_JAR; if (item.getSourceFilePath() != null) { - icn = new ImageIcon( ImageUtilities.mergeImages( icn.getImage(), ProjectProperties.ICON_SOURCE_BADGE.getImage(), 8, 8 )); + icn = ImageUtilities.mergeIcons(icn, ProjectProperties.ICON_SOURCE_BADGE, 8, 8 ); } if (item.getJavadocFilePath() != null) { - icn = new ImageIcon( ImageUtilities.mergeImages( icn.getImage(), ProjectProperties.ICON_JAVADOC_BADGE.getImage(), 8, 0 )); + icn = ImageUtilities.mergeIcons(icn, ProjectProperties.ICON_JAVADOC_BADGE, 8, 0 ); } return icn; } @@ -274,13 +272,11 @@ private String getToolTipText( ClassPathSupport.Item item ) { return null; } - private static ImageIcon getFolderIcon() { - + private static Icon getFolderIcon() { if ( ICON_FOLDER == null ) { DataFolder dataFolder = DataFolder.findFolder( FileUtil.getConfigRoot() ); - ICON_FOLDER = new ImageIcon( dataFolder.getNodeDelegate().getIcon( BeanInfo.ICON_COLOR_16x16 ) ); + ICON_FOLDER = ImageUtilities.image2Icon(dataFolder.getNodeDelegate().getIcon( BeanInfo.ICON_COLOR_16x16 ) ); } - return ICON_FOLDER; } diff --git a/java/java.editor/src/org/netbeans/modules/java/editor/codegen/ui/CheckRenderer.java b/java/java.editor/src/org/netbeans/modules/java/editor/codegen/ui/CheckRenderer.java index 714567c13ec9..4885fe954c38 100644 --- a/java/java.editor/src/org/netbeans/modules/java/editor/codegen/ui/CheckRenderer.java +++ b/java/java.editor/src/org/netbeans/modules/java/editor/codegen/ui/CheckRenderer.java @@ -29,7 +29,6 @@ import java.util.List; import javax.swing.ButtonGroup; import javax.swing.ButtonModel; -import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JList; @@ -39,6 +38,7 @@ import javax.swing.tree.TreeCellRenderer; import org.openide.explorer.view.Visualizer; import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; /** * @author Petr Hrebejk @@ -99,7 +99,7 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, } label.setText( n.getHtmlDisplayName() ); - label.setIcon( new ImageIcon( n.getIcon(BeanInfo.ICON_COLOR_16x16) ) ); // XXX Ask description directly + label.setIcon( ImageUtilities.image2Icon( n.getIcon(BeanInfo.ICON_COLOR_16x16) ) ); // XXX Ask description directly panel.add(check, BorderLayout.WEST ); panel.add(label, BorderLayout.CENTER ); diff --git a/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ElementDescription.java b/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ElementDescription.java index 1c4c83695993..7e8e083a6ab2 100644 --- a/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ElementDescription.java +++ b/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ElementDescription.java @@ -169,17 +169,17 @@ public ElementHandle getHandle() { } public Icon getIcon() { - Image badge; + Icon badge; if (overriddenFlag) { - badge = ImageUtilities.loadImage("org/netbeans/modules/java/editor/resources/is-overridden-badge.png"); + badge = ImageUtilities.loadIcon("org/netbeans/modules/java/editor/resources/is-overridden-badge.png"); } else { - badge = ImageUtilities.loadImage("org/netbeans/modules/java/editor/resources/overrides-badge.png"); + badge = ImageUtilities.loadIcon("org/netbeans/modules/java/editor/resources/overrides-badge.png"); } - Image icon = ImageUtilities.icon2Image(ElementIcons.getElementIcon(imageKind, modifiers)); + Icon icon = ElementIcons.getElementIcon(imageKind, modifiers); - return ImageUtilities.image2Icon(ImageUtilities.mergeImages(icon, badge, 16, 0)); + return ImageUtilities.mergeIcons(icon, badge, 16, 0); } public boolean isOverridden() { diff --git a/java/java.hints.ui/src/org/netbeans/modules/java/hints/spiimpl/refactoring/InspectAndRefactorPanel.java b/java/java.hints.ui/src/org/netbeans/modules/java/hints/spiimpl/refactoring/InspectAndRefactorPanel.java index 3f0d46fc8fb4..e419d5beef75 100644 --- a/java/java.hints.ui/src/org/netbeans/modules/java/hints/spiimpl/refactoring/InspectAndRefactorPanel.java +++ b/java/java.hints.ui/src/org/netbeans/modules/java/hints/spiimpl/refactoring/InspectAndRefactorPanel.java @@ -185,7 +185,7 @@ public void actionPerformed(ActionEvent e) { customScopeLab = new JLabel(NbBundle.getMessage(InspectAndRefactorPanel.class, "LBL_CustomScope"), prj , SwingConstants.LEFT); //NOI18N if (fileObject!=null) { if (!fileObject.isFolder()) - currentFile = new JLabel(NbBundle.getMessage(InspectAndRefactorPanel.class, "LBL_CurrentFile", fileObject.getNameExt()), new ImageIcon(dob.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)), SwingConstants.LEFT); + currentFile = new JLabel(NbBundle.getMessage(InspectAndRefactorPanel.class, "LBL_CurrentFile", fileObject.getNameExt()), ImageUtilities.image2Icon(dob.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)), SwingConstants.LEFT); String packageName = getPackageName(fileObject); if (packageName!=null) currentPackage = new JLabel(NbBundle.getMessage(InspectAndRefactorPanel.class, "LBL_CurrentPackage", packageName), ImageUtilities.loadImageIcon(PACKAGE, false), SwingConstants.LEFT); diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/analyzer/ui/CheckRenderer.java b/java/java.hints/src/org/netbeans/modules/java/hints/analyzer/ui/CheckRenderer.java index c104e372f648..8c750b574473 100644 --- a/java/java.hints/src/org/netbeans/modules/java/hints/analyzer/ui/CheckRenderer.java +++ b/java/java.hints/src/org/netbeans/modules/java/hints/analyzer/ui/CheckRenderer.java @@ -26,10 +26,8 @@ import java.awt.event.MouseListener; import java.beans.BeanInfo; import java.util.Collection; -import java.util.List; import javax.swing.ButtonGroup; import javax.swing.ButtonModel; -import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JList; @@ -39,6 +37,7 @@ import javax.swing.tree.TreeCellRenderer; import org.openide.explorer.view.Visualizer; import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; /** * @author Petr Hrebejk @@ -106,7 +105,7 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, } label.setText( displayName ); - label.setIcon( new ImageIcon( n.getIcon(BeanInfo.ICON_COLOR_16x16) ) ); // XXX Ask description directly + label.setIcon( ImageUtilities.image2Icon( n.getIcon(BeanInfo.ICON_COLOR_16x16) ) ); // XXX Ask description directly return this; diff --git a/java/java.j2seembedded/src/org/netbeans/modules/java/j2seembedded/ui/CreateJREPanel.java b/java/java.j2seembedded/src/org/netbeans/modules/java/j2seembedded/ui/CreateJREPanel.java index 95f8e054f88f..866d22be5fbb 100644 --- a/java/java.j2seembedded/src/org/netbeans/modules/java/j2seembedded/ui/CreateJREPanel.java +++ b/java/java.j2seembedded/src/org/netbeans/modules/java/j2seembedded/ui/CreateJREPanel.java @@ -604,8 +604,8 @@ private static void setEJDKHome(@NullAllowed final String path) { } private static final class EJDKFileView extends FileView { - private static final Image BADGE = ImageUtilities.loadImage("org/netbeans/modules/java/j2seembedded/resources/ejdkBadge.gif", false); // NOI18N - private static final ImageIcon EMPTY = ImageUtilities.loadImageIcon("org/netbeans/modules/java/j2seembedded/resources/empty.gif", false); // NOI18N + private static final Icon BADGE = ImageUtilities.loadIcon("org/netbeans/modules/java/j2seembedded/resources/ejdkBadge.gif"); // NOI18N + private static final Icon EMPTY = ImageUtilities.loadIcon("org/netbeans/modules/java/j2seembedded/resources/empty.gif"); // NOI18N private final FileSystemView fsv; private Icon lastOrig; @@ -628,11 +628,11 @@ public Icon getIcon(@NonNull final File file) { assert lastMerged != null; return lastMerged; } - lastMerged = ImageUtilities.image2Icon(ImageUtilities.mergeImages( - ImageUtilities.icon2Image(original), + lastMerged = ImageUtilities.mergeIcons( + original, BADGE, - original.getIconWidth() - BADGE.getWidth(null), - original.getIconHeight()- BADGE.getHeight(null))); + original.getIconWidth() - BADGE.getIconWidth(), + original.getIconHeight()- BADGE.getIconHeight()); lastOrig = original; return lastMerged; } else { diff --git a/java/java.navigation/src/org/netbeans/modules/java/navigation/base/Icons.java b/java/java.navigation/src/org/netbeans/modules/java/navigation/base/Icons.java index 1f5642ecf318..bf9b63d929e0 100644 --- a/java/java.navigation/src/org/netbeans/modules/java/navigation/base/Icons.java +++ b/java/java.navigation/src/org/netbeans/modules/java/navigation/base/Icons.java @@ -19,11 +19,8 @@ package org.netbeans.modules.java.navigation.base; -import java.awt.Image; import javax.swing.Icon; -import javax.swing.ImageIcon; import org.openide.util.ImageUtilities; -import org.openide.util.Utilities; /** Capable of serving incns for the navigator modules. Notice that it is not * used for Element icons. May not be necessary an may be removed later. @@ -41,13 +38,7 @@ public Icons() { } public static Icon getBusyIcon () { - Image img = ImageUtilities.loadImage (WAIT); - if (img == null) { - return null; - } - else { - return new ImageIcon (img); - } + return ImageUtilities.loadIcon (WAIT); } } diff --git a/java/java.project.ui/src/org/netbeans/spi/java/project/support/ui/PackageView.java b/java/java.project.ui/src/org/netbeans/spi/java/project/support/ui/PackageView.java index 6d2efb771109..72432107bdc8 100644 --- a/java/java.project.ui/src/org/netbeans/spi/java/project/support/ui/PackageView.java +++ b/java/java.project.ui/src/org/netbeans/spi/java/project/support/ui/PackageView.java @@ -38,7 +38,6 @@ import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.ListCellRenderer; @@ -63,6 +62,7 @@ import org.openide.nodes.AbstractNode; import org.openide.nodes.FilterNode; import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle.Messages; import org.openide.util.Parameters; import org.openide.util.WeakListeners; @@ -374,7 +374,7 @@ public Icon getIcon() { Image image = PackageDisplayUtils.getIcon(pkg, empty); icon = image2icon.get(image); if ( icon == null ) { - icon = new ImageIcon( image ); + icon = ImageUtilities.image2Icon( image ); image2icon.put( image, icon ); } } diff --git a/java/maven/src/org/netbeans/modules/maven/problems/BatchProblemNotifier.java b/java/maven/src/org/netbeans/modules/maven/problems/BatchProblemNotifier.java index 3ebff6eb3b68..e9e43a3bd32a 100644 --- a/java/maven/src/org/netbeans/modules/maven/problems/BatchProblemNotifier.java +++ b/java/maven/src/org/netbeans/modules/maven/problems/BatchProblemNotifier.java @@ -197,9 +197,9 @@ private static class Reactor implements ActionListener { this.root = root; n = NotificationDisplayer.getDefault().notify( build_title(root.getName()), - ImageUtilities.image2Icon(ImageUtilities.mergeImages( - ImageUtilities.loadImage(IconResources.MAVEN_ICON, true), - ImageUtilities.loadImage(IconResources.BROKEN_PROJECT_BADGE_ICON, true), 8, 0)), + ImageUtilities.mergeIcons( + ImageUtilities.loadIcon(IconResources.MAVEN_ICON, true), + ImageUtilities.loadIcon(IconResources.BROKEN_PROJECT_BADGE_ICON, true), 8, 0), build_details(root), this); LOG.log(Level.FINE, "created for {0}", root); } diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/WhereUsedBinaryElement.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/WhereUsedBinaryElement.java index 527b5ad05ce2..9df59944d1a1 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/WhereUsedBinaryElement.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/WhereUsedBinaryElement.java @@ -18,10 +18,8 @@ */ package org.netbeans.modules.refactoring.java; -import java.awt.Image; import java.beans.BeanInfo; import javax.swing.Icon; -import javax.swing.ImageIcon; import org.netbeans.modules.refactoring.java.spi.JavaWhereUsedFilters; import org.netbeans.modules.refactoring.java.ui.tree.ElementGripFactory; import org.netbeans.modules.refactoring.spi.FiltersManager; @@ -64,14 +62,12 @@ public String getDisplayText() { public Lookup getLookup() { Icon icon = null; try { - ImageIcon imageIcon = new ImageIcon(DataObject.find(fo).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); + icon = ImageUtilities.image2Icon(DataObject.find(fo).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); Boolean inTestFile = ElementGripFactory.getDefault().inTestFile(fo); if (Boolean.TRUE == inTestFile) { - Image mergeImages = ImageUtilities.mergeImages(imageIcon.getImage(), - ImageUtilities.loadImageIcon("org/netbeans/modules/refactoring/java/resources/found_item_test.png", false).getImage(), 4, 4); - imageIcon = new ImageIcon(mergeImages); + icon = ImageUtilities.mergeIcons(icon, + ImageUtilities.loadIcon("org/netbeans/modules/refactoring/java/resources/found_item_test.png"), 4, 4); } - icon = imageIcon; } catch (DataObjectNotFoundException ex) { // ignore } diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/callhierarchy/Call.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/callhierarchy/Call.java index 5919fcf51980..1a878626c81f 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/callhierarchy/Call.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/callhierarchy/Call.java @@ -192,12 +192,12 @@ private static Call createReference(CompilationInfo javac, TreePath selection, E if (isCallerGraph) { if (parent != null) { - c.icon = ImageUtilities.image2Icon(ImageUtilities.mergeImages(ImageUtilities.icon2Image(i), ImageUtilities.loadImage("org/netbeans/modules/refactoring/java/resources/up.png"), 0, 0)); + c.icon = ImageUtilities.mergeIcons(i, ImageUtilities.loadIcon("org/netbeans/modules/refactoring/java/resources/up.png"), 0, 0); } else { c.icon = i; } } else { - c.icon = ImageUtilities.image2Icon(ImageUtilities.mergeImages(ImageUtilities.icon2Image(i), ImageUtilities.loadImage("org/netbeans/modules/refactoring/java/resources/down.png"), 0, 0)); + c.icon = ImageUtilities.mergeIcons(i, ImageUtilities.loadIcon("org/netbeans/modules/refactoring/java/resources/down.png"), 0, 0); } c.selection = TreePathHandle.create(selection, javac); diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java index 4b732c3ce8ba..1647dac0b1b3 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java @@ -63,6 +63,7 @@ import org.openide.filesystems.FileObject; import org.openide.nodes.Node; import org.openide.util.Exceptions; +import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; @@ -739,7 +740,7 @@ public Component getListCellRendererComponent(JList list, Object value, int inde } else if (value instanceof Node) { Node node = (Node) value; setText(node.getHtmlDisplayName()); - setIcon(new ImageIcon(node.getIcon(BeanInfo.ICON_COLOR_16x16))); + setIcon(ImageUtilities.image2Icon(node.getIcon(BeanInfo.ICON_COLOR_16x16))); } else { // #49954: render a specially inserted class somehow. String item = (String) value; diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentFileScopeProvider.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentFileScopeProvider.java index 00d3c5a9de4e..615502f2d2cd 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentFileScopeProvider.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentFileScopeProvider.java @@ -22,13 +22,13 @@ import java.util.Arrays; import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.Icon; -import javax.swing.ImageIcon; import org.netbeans.modules.refactoring.api.Scope; import org.netbeans.modules.refactoring.spi.ui.ScopeProvider; import org.netbeans.modules.refactoring.spi.ui.ScopeReference; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; +import org.openide.util.ImageUtilities; import org.openide.util.Lookup; import org.openide.util.NbBundle.Messages; @@ -42,7 +42,7 @@ public final class CurrentFileScopeProvider extends ScopeProvider { private Scope scope; - private ImageIcon icon; + private Icon icon; private String detail; @Override @@ -57,7 +57,7 @@ public boolean initialize(Lookup context, AtomicBoolean cancel) { currentFileDo = DataObject.find(file); } catch (DataObjectNotFoundException ex) { } // Not important, only for Icon. - icon = currentFileDo != null ? new ImageIcon(currentFileDo.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)) : null; + icon = currentFileDo != null ? ImageUtilities.image2Icon(currentFileDo.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)) : null; detail = file.getNameExt(); scope = Scope.create(null, null, Arrays.asList(file)); diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentJavaProjectDependenciesScopeProvider.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentJavaProjectDependenciesScopeProvider.java index 94bf76b772f1..1c8fcdfec2a7 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentJavaProjectDependenciesScopeProvider.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/scope/CurrentJavaProjectDependenciesScopeProvider.java @@ -98,10 +98,10 @@ public boolean initialize(Lookup context, AtomicBoolean cancel) { } scope = Scope.create(Arrays.asList(projectSources), null, null, true); detail = pi.getDisplayName(); - icon = new ImageIcon(ImageUtilities.mergeImages( - ImageUtilities.icon2Image(pi.getIcon()), - ImageUtilities.loadImage("org/netbeans/modules/refactoring/java/resources/binary_badge.gif"), - 10, 10)); + icon = ImageUtilities.mergeIcons( + pi.getIcon(), + ImageUtilities.loadIcon("org/netbeans/modules/refactoring/java/resources/binary_badge.gif"), + 10, 10); return true; } diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/FileTreeElement.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/FileTreeElement.java index 92f9c5ad555d..9f8794586eeb 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/FileTreeElement.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/FileTreeElement.java @@ -19,12 +19,10 @@ package org.netbeans.modules.refactoring.java.ui.tree; -import java.awt.Image; import java.beans.BeanInfo; import java.net.URISyntaxException; import java.net.URL; import javax.swing.Icon; -import javax.swing.ImageIcon; import org.netbeans.api.actions.Openable; import org.netbeans.api.java.platform.JavaPlatform; import org.netbeans.api.java.platform.JavaPlatformManager; @@ -112,14 +110,13 @@ public TreeElement getParent(boolean isLogical) { @Override public Icon getIcon() { try { - ImageIcon imageIcon = new ImageIcon(DataObject.find(fo).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); + Icon icon = ImageUtilities.image2Icon(DataObject.find(fo).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)); Boolean inTestFile = ElementGripFactory.getDefault().inTestFile(fo); if(Boolean.TRUE == inTestFile) { - Image mergeImages = ImageUtilities.mergeImages(imageIcon.getImage(), - ImageUtilities.loadImageIcon("org/netbeans/modules/refactoring/java/resources/found_item_test.png", false).getImage(), 4, 4); - imageIcon = new ImageIcon(mergeImages); + icon = ImageUtilities.mergeIcons(icon, + ImageUtilities.loadIcon("org/netbeans/modules/refactoring/java/resources/found_item_test.png"), 4, 4); } - return imageIcon; + return icon; } catch (DataObjectNotFoundException ex) { return null; } diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/JavaPlatformTreeElement.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/JavaPlatformTreeElement.java index 053368037070..5fb2fba01940 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/JavaPlatformTreeElement.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/JavaPlatformTreeElement.java @@ -41,7 +41,7 @@ public class JavaPlatformTreeElement implements TreeElement { JavaPlatformTreeElement(JavaPlatform platform) { this.platform = platform; - icon = new ImageIcon(ImageUtilities.loadImage(PLATFORM_ICON)); + icon = ImageUtilities.loadIcon(PLATFORM_ICON); displayName = platform.getDisplayName(); } diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/SourceGroupTreeElement.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/SourceGroupTreeElement.java index 207324a15c4c..ab0dd0a3dd0f 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/SourceGroupTreeElement.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/tree/SourceGroupTreeElement.java @@ -23,7 +23,6 @@ import java.beans.BeanInfo; import java.lang.ref.WeakReference; import javax.swing.Icon; -import javax.swing.ImageIcon; import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.SourceGroup; import org.netbeans.modules.refactoring.spi.ui.TreeElement; @@ -55,7 +54,7 @@ public class SourceGroupTreeElement implements TreeElement { try { Image image = DataObject.find(sg.getRootFolder()).getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16); image = ImageUtilities.mergeImages( image, ImageUtilities.loadImage(PACKAGE_BADGE), 7, 7 ); - icon = new ImageIcon(image); + icon = ImageUtilities.image2Icon(image); } catch (DataObjectNotFoundException d) { } } diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/actions/ImportModulePanel.java b/php/php.editor/src/org/netbeans/modules/php/editor/actions/ImportModulePanel.java index eb79bb650c58..a4704edb7794 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/actions/ImportModulePanel.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/actions/ImportModulePanel.java @@ -331,7 +331,7 @@ public Component getListCellRendererComponent(JList list, } // TODO - depend on gsf directly and get icons from there! //setIcon( ElementIcons.getElementIcon( td.kind, null ) ); - setIcon(new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/php/editor/resources/interface.png"))); // NOI18N + setIcon(ImageUtilities.loadIcon("org/netbeans/modules/php/editor/resources/interface.png")); // NOI18N } else { setText(value.toString()); } diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/codegen/ui/CheckBoxTreeRenderer.java b/php/php.editor/src/org/netbeans/modules/php/editor/codegen/ui/CheckBoxTreeRenderer.java index dca640222ea0..40de4846247a 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/codegen/ui/CheckBoxTreeRenderer.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/codegen/ui/CheckBoxTreeRenderer.java @@ -20,13 +20,13 @@ import java.awt.BorderLayout; import java.awt.Component; -import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.tree.TreeCellRenderer; +import org.openide.util.ImageUtilities; /** * @@ -59,7 +59,7 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, if (value instanceof CheckNode) { CheckNode n = (CheckNode) value; check.setSelected(n.isSelected()); - label.setIcon(new ImageIcon(n.getIcon())); // XXX Ask description directly + label.setIcon(ImageUtilities.image2Icon(n.getIcon())); // XXX Ask description directly } if (isSelected) { label.setForeground(LIST_FOR_COLORS.getSelectionForeground()); diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPDOCCodeCompletion.java b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPDOCCodeCompletion.java index 4df7eb259bd8..cd05a0137828 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPDOCCodeCompletion.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPDOCCodeCompletion.java @@ -227,7 +227,7 @@ private static void completeAnnotation(final PHPCompletionResult completionResul public static class PHPDOCCodeCompletionItem implements CompletionProposal { private static final String PHP_ANNOTATION_ICON = "org/netbeans/modules/php/editor/resources/annotation.png"; //NOI18N - private static final ImageIcon ANNOTATION_ICON = new ImageIcon(ImageUtilities.loadImage(PHP_ANNOTATION_ICON)); + private static final ImageIcon ANNOTATION_ICON = ImageUtilities.loadImageIcon(PHP_ANNOTATION_ICON, false); private final AnnotationCompletionTag tag; private final int anchorOffset; private final PHPDOCTagElement elem; diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/nav/hierarchy/ClassHierarchyPanel.java b/php/php.editor/src/org/netbeans/modules/php/editor/nav/hierarchy/ClassHierarchyPanel.java index bda918d34b56..0d2c0cb66a4a 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/nav/hierarchy/ClassHierarchyPanel.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/nav/hierarchy/ClassHierarchyPanel.java @@ -31,7 +31,6 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; @@ -580,7 +579,7 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, if (value instanceof TypeNode) { TypeNode n = (TypeNode) value; stringValue = n.toStringAsHtml(); - label.setIcon(new ImageIcon(n.getIcon())); + label.setIcon(ImageUtilities.image2Icon(n.getIcon())); } if (isSelected) { label.setForeground(LIST_FOR_COLORS.getSelectionForeground()); diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/sql/SelectConnectionItem.java b/php/php.editor/src/org/netbeans/modules/php/editor/sql/SelectConnectionItem.java index e66653e7cde3..bfafb7e46830 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/sql/SelectConnectionItem.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/sql/SelectConnectionItem.java @@ -41,7 +41,7 @@ */ public class SelectConnectionItem implements CompletionItem { - private static final ImageIcon CONNECTION_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/php/editor/resources/connection.gif")); // NOI18N + private static final ImageIcon CONNECTION_ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/php/editor/resources/connection.gif", false); // NOI18N private Document doc; private DatabaseConnection dbconn; diff --git a/php/php.latte/src/org/netbeans/modules/php/latte/completion/LatteCompletionProposal.java b/php/php.latte/src/org/netbeans/modules/php/latte/completion/LatteCompletionProposal.java index 66b08fdf9bee..580a2766d235 100644 --- a/php/php.latte/src/org/netbeans/modules/php/latte/completion/LatteCompletionProposal.java +++ b/php/php.latte/src/org/netbeans/modules/php/latte/completion/LatteCompletionProposal.java @@ -102,7 +102,7 @@ public String getCustomInsertTemplate() { } abstract static class MacroCompletionProposal extends LatteCompletionProposal { - private static final ImageIcon MACRO_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/php/latte/resources/macro_cc_icon.png")); //NOI18N + private static final ImageIcon MACRO_ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/php/latte/resources/macro_cc_icon.png", false); //NOI18N public MacroCompletionProposal(LatteElement element, CompletionRequest request) { super(element, request); @@ -159,7 +159,7 @@ public int getSortPrioOverride() { } static class HelperCompletionProposal extends LatteCompletionProposal { - private static final ImageIcon HELPER_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/php/latte/resources/helper_cc_icon.png")); //NOI18N + private static final ImageIcon HELPER_ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/php/latte/resources/helper_cc_icon.png", false); //NOI18N public HelperCompletionProposal(LatteElement element, CompletionRequest request) { super(element, request); @@ -184,7 +184,7 @@ public ImageIcon getIcon() { } static class KeywordCompletionProposal extends LatteCompletionProposal { - private static final ImageIcon KEYWORD_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/php/latte/resources/latte_cc_icon.png")); //NOI18N + private static final ImageIcon KEYWORD_ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/php/latte/resources/latte_cc_icon.png", false); //NOI18N public KeywordCompletionProposal(LatteElement element, CompletionRequest request) { super(element, request); } @@ -301,7 +301,7 @@ public int getSortPrioOverride() { } static class ControlCompletionProposal extends LatteCompletionProposal { - private static final ImageIcon CONTROL_ICON = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/php/latte/resources/latte_cc_icon.png")); //NOI18N + private static final ImageIcon CONTROL_ICON = ImageUtilities.loadImageIcon("org/netbeans/modules/php/latte/resources/latte_cc_icon.png", false); //NOI18N public ControlCompletionProposal(LatteElement element, CompletionRequest request) { super(element, request); diff --git a/php/php.project/src/org/netbeans/modules/php/project/connections/ui/transfer/TransferFilesChooserVisual.java b/php/php.project/src/org/netbeans/modules/php/project/connections/ui/transfer/TransferFilesChooserVisual.java index d430139d07a5..f79640192bb8 100644 --- a/php/php.project/src/org/netbeans/modules/php/project/connections/ui/transfer/TransferFilesChooserVisual.java +++ b/php/php.project/src/org/netbeans/modules/php/project/connections/ui/transfer/TransferFilesChooserVisual.java @@ -100,7 +100,7 @@ void updateWarning() { default: throw new IllegalStateException("Unknown transfer type: " + transferType); } - warningLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(INFO_ICON, false))); + warningLabel.setIcon(ImageUtilities.loadIcon(INFO_ICON)); warningLabel.setText(NbBundle.getMessage(TransferFilesChooserVisual.class, msgKey)); } } diff --git a/php/php.project/src/org/netbeans/modules/php/project/ui/PathUiSupport.java b/php/php.project/src/org/netbeans/modules/php/project/ui/PathUiSupport.java index 1ec09d29c615..f7f5c4192a13 100644 --- a/php/php.project/src/org/netbeans/modules/php/project/ui/PathUiSupport.java +++ b/php/php.project/src/org/netbeans/modules/php/project/ui/PathUiSupport.java @@ -190,8 +190,8 @@ public static class ClassPathListCellRenderer implements ListCellRenderer w ? icon2.getIconWidth() + x : w; - h = icon2.getIconHeight() + y > h ? icon2.getIconHeight() + y : h; - } - if (w < 1) w = 16; - if (h < 1) h = 16; - - java.awt.image.ColorModel model = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment (). - getDefaultScreenDevice ().getDefaultConfiguration (). - getColorModel (java.awt.Transparency.BITMASK); - java.awt.image.BufferedImage buffImage = new java.awt.image.BufferedImage (model, - model.createCompatibleWritableRaster (w, h), model.isAlphaPremultiplied (), null); - - java.awt.Graphics g = buffImage.createGraphics (); - if (icon1 != null) { - icon1.paintIcon(c, g, 0, 0); - } - if (icon2 != null) { - icon2.paintIcon(c, g, x, y); - } - g.dispose(); - - return new ImageIcon(buffImage); - } - } diff --git a/platform/openide.loaders/src/org/openide/awt/DynaMenuModel.java b/platform/openide.loaders/src/org/openide/awt/DynaMenuModel.java index 2671fc62cba5..a72fbf19135c 100644 --- a/platform/openide.loaders/src/org/openide/awt/DynaMenuModel.java +++ b/platform/openide.loaders/src/org/openide/awt/DynaMenuModel.java @@ -46,7 +46,7 @@ * @author mkleint */ class DynaMenuModel { - private static final Icon BLANK_ICON = new ImageIcon(ImageUtilities.loadImage("org/openide/loaders/empty.gif")); // NOI18N + private static final Icon BLANK_ICON = ImageUtilities.loadIcon("org/openide/loaders/empty.gif"); // NOI18N private List menuItems; private HashMap actionToMenuMap; diff --git a/platform/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java b/platform/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java index 3e363f78e9bb..95f2905cc71f 100644 --- a/platform/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java +++ b/platform/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java @@ -56,8 +56,7 @@ public void helpChanged() { @Override public Icon getIcon() { if (icon == null) { - Image image = ImageUtilities.loadImage("org/netbeans/modules/options/resources/advanced.png"); - icon = new ImageIcon(image); + icon = ImageUtilities.loadIcon("org/netbeans/modules/options/resources/advanced.png"); } return icon; } diff --git a/platform/progress.ui/src/org/netbeans/modules/progress/ui/ListComponent.java b/platform/progress.ui/src/org/netbeans/modules/progress/ui/ListComponent.java index b4ca8c5a58e2..127335c34e42 100644 --- a/platform/progress.ui/src/org/netbeans/modules/progress/ui/ListComponent.java +++ b/platform/progress.ui/src/org/netbeans/modules/progress/ui/ListComponent.java @@ -196,7 +196,7 @@ public void focusLost(java.awt.event.FocusEvent e) { static Icon iconOrImage2icon( Object iconOrImage ) { return (iconOrImage instanceof Icon) ? (Icon) iconOrImage - : new ImageIcon( (Image) iconOrImage ); + : ImageUtilities.image2Icon( (Image) iconOrImage ); } diff --git a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/image/ImageDetailProvider.java b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/image/ImageDetailProvider.java index cc88c8c5d73f..3e79c9568545 100644 --- a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/image/ImageDetailProvider.java +++ b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/image/ImageDetailProvider.java @@ -30,7 +30,6 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.util.logging.Level; -import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenuItem; @@ -51,6 +50,7 @@ import org.openide.windows.TopComponent; import static org.netbeans.modules.profiler.heapwalk.details.jdk.image.ImageBuilder.LOGGER; import static org.netbeans.modules.profiler.heapwalk.details.jdk.image.ImageBuilder.BUILDERS; +import org.openide.util.ImageUtilities; /** * @@ -305,7 +305,7 @@ private static class ImageTopComponent extends ProfilerTopComponent { drawChecker(g, 0, 0, width, height); g.drawImage(image, 0, 0, null); - JComponent c = new JScrollPane(new JLabel(new ImageIcon(displayedImage))); + JComponent c = new JScrollPane(new JLabel(ImageUtilities.image2Icon(displayedImage))); add(c, BorderLayout.CENTER); diff --git a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/BaseBuilders.java b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/BaseBuilders.java index 16f1c86ff863..3fe899acd74f 100644 --- a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/BaseBuilders.java +++ b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/BaseBuilders.java @@ -33,6 +33,7 @@ import org.netbeans.modules.profiler.heapwalk.details.jdk.ui.Utils.InstanceBuilder; import org.netbeans.modules.profiler.heapwalk.details.jdk.ui.Utils.PlaceholderIcon; import org.netbeans.modules.profiler.heapwalk.details.spi.DetailsUtils; +import org.openide.util.ImageUtilities; /** * @@ -219,7 +220,7 @@ protected Icon createInstanceImpl() { if(image == null) { return new PlaceholderIcon(width, height); } - return new ImageIcon(image); + return ImageUtilities.image2Icon(image); } } diff --git a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/WindowBuilders.java b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/WindowBuilders.java index 1dadf4c1d4bc..895820352eb7 100644 --- a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/WindowBuilders.java +++ b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/jdk/ui/WindowBuilders.java @@ -25,7 +25,6 @@ import java.awt.Image; import java.beans.PropertyVetoException; import java.util.List; -import javax.swing.ImageIcon; import javax.swing.JDesktopPane; import javax.swing.JDialog; import javax.swing.JFrame; @@ -42,6 +41,7 @@ import org.netbeans.modules.profiler.heapwalk.details.jdk.ui.ComponentBuilders.ContainerBuilder; import org.netbeans.modules.profiler.heapwalk.details.jdk.ui.ComponentBuilders.JComponentBuilder; import org.netbeans.modules.profiler.heapwalk.details.spi.DetailsUtils; +import org.openide.util.ImageUtilities; /** * @@ -184,7 +184,7 @@ protected Component createPresenterImpl(Frame instance) { } else { JInternalFrame presenter = new JInternalFrame(instance.getTitle()); Image img = instance.getIconImage(); - if (img != null) presenter.setFrameIcon(new ImageIcon(img)); + if (img != null) presenter.setFrameIcon(ImageUtilities.image2Icon(img)); for (Component c : instance.getComponents()) presenter.add(c); presenter.pack(); return presenter; @@ -265,7 +265,7 @@ protected Component createPresenterImpl(Dialog instance) { JInternalFrame presenter = new JInternalFrame(instance.getTitle()); List images = instance.getIconImages(); Image img = images.isEmpty() ? null : images.get(0); - if (img != null) presenter.setFrameIcon(new ImageIcon(img)); + if (img != null) presenter.setFrameIcon(ImageUtilities.image2Icon(img)); for (Component c : instance.getComponents()) presenter.add(c); presenter.pack(); return presenter; diff --git a/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TimedTakeSnapshotProfilingPointFactory.java b/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TimedTakeSnapshotProfilingPointFactory.java index 00e43a8f4c49..9a678dd99a6b 100644 --- a/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TimedTakeSnapshotProfilingPointFactory.java +++ b/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TimedTakeSnapshotProfilingPointFactory.java @@ -23,13 +23,11 @@ import org.openide.ErrorManager; import org.openide.util.NbBundle; import java.util.Properties; -import javax.swing.GrayFilter; import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.UIManager; import org.netbeans.modules.profiler.api.ProjectUtilities; import org.netbeans.modules.profiler.api.icons.Icons; import org.netbeans.modules.profiler.ppoints.ui.ProfilingPointsIcons; +import org.openide.util.ImageUtilities; import org.openide.util.Lookup; @@ -61,12 +59,7 @@ public Icon getIcon() { } public Icon getDisabledIcon() { - Icon icon = UIManager.getLookAndFeel().getDisabledIcon(null, - Icons.getIcon(ProfilingPointsIcons.TAKE_SNAPSHOT_TIMED)); - if (icon == null) - icon = new ImageIcon(GrayFilter.createDisabledImage( - Icons.getImage(ProfilingPointsIcons.TAKE_SNAPSHOT_TIMED))); - return icon; + return ImageUtilities.createDisabledIcon(getIcon()); } public int getScope() { diff --git a/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TriggeredTakeSnapshotProfilingPointFactory.java b/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TriggeredTakeSnapshotProfilingPointFactory.java index 9bbe6717461d..1eaff76ac0c9 100644 --- a/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TriggeredTakeSnapshotProfilingPointFactory.java +++ b/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/TriggeredTakeSnapshotProfilingPointFactory.java @@ -23,13 +23,11 @@ import org.openide.ErrorManager; import org.openide.util.NbBundle; import java.util.Properties; -import javax.swing.GrayFilter; import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.UIManager; import org.netbeans.modules.profiler.api.ProjectUtilities; import org.netbeans.modules.profiler.api.icons.Icons; import org.netbeans.modules.profiler.ppoints.ui.ProfilingPointsIcons; +import org.openide.util.ImageUtilities; import org.openide.util.Lookup; @@ -60,12 +58,7 @@ public Icon getIcon() { } public Icon getDisabledIcon() { - Icon icon = UIManager.getLookAndFeel().getDisabledIcon(null, - Icons.getIcon(ProfilingPointsIcons.TAKE_SNAPSHOT_TRIGGERED)); - if (icon == null) - icon = new ImageIcon(GrayFilter.createDisabledImage( - Icons.getImage(ProfilingPointsIcons.TAKE_SNAPSHOT_TRIGGERED))); - return icon; + return ImageUtilities.createDisabledIcon(getIcon()); } public int getScope() { diff --git a/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Utils.java b/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Utils.java index 0cbddccc4a13..88ec94c2622f 100644 --- a/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Utils.java +++ b/profiler/profiler.ppoints/src/org/netbeans/modules/profiler/ppoints/Utils.java @@ -152,7 +152,7 @@ public void setValue(Object value, int row) { } setText(""); // NOI18N - setIcon(isEnabled() ? icon : disabledIcon(icon)); + setIcon(isEnabled() ? icon : ImageUtilities.createDisabledIcon(icon)); } public String toString() { @@ -160,10 +160,6 @@ public String toString() { } } - private static Icon disabledIcon(Icon icon) { - return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); - } - private static class ProjectPresenterListRenderer extends DefaultListCellRenderer { //~ Inner Classes -------------------------------------------------------------------------------------------------------- @@ -241,7 +237,7 @@ public void setValue(Object value, int row) { Lookup.Provider project = (Lookup.Provider)value; setText(ProjectUtilities.getDisplayName(project)); Icon icon = ProjectUtilities.getIcon(project); - setIcon(isEnabled() ? icon : disabledIcon(icon)); + setIcon(isEnabled() ? icon : ImageUtilities.createDisabledIcon(icon)); setFont(Objects.equals(ProjectUtilities.getMainProject(), value) ? font.deriveFont(Font.BOLD) : font); // bold for main project } } diff --git a/profiler/profiler/src/org/netbeans/modules/profiler/v2/impl/ProjectsSelector.java b/profiler/profiler/src/org/netbeans/modules/profiler/v2/impl/ProjectsSelector.java index 5e423260c5d9..8665ced4060d 100644 --- a/profiler/profiler/src/org/netbeans/modules/profiler/v2/impl/ProjectsSelector.java +++ b/profiler/profiler/src/org/netbeans/modules/profiler/v2/impl/ProjectsSelector.java @@ -26,9 +26,7 @@ import java.util.HashSet; import java.util.Objects; import javax.swing.BorderFactory; -import javax.swing.GrayFilter; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JToolBar; @@ -43,6 +41,7 @@ import org.netbeans.lib.profiler.ui.swing.renderer.CheckBoxRenderer; import org.netbeans.lib.profiler.ui.swing.renderer.LabelRenderer; import org.netbeans.modules.profiler.api.ProjectUtilities; +import org.openide.util.ImageUtilities; import org.openide.util.Lookup; import org.openide.util.NbBundle; @@ -216,15 +215,10 @@ public void setValue(Object value, int row) { Lookup.Provider project = (Lookup.Provider)value; setText(ProjectUtilities.getDisplayName(project)); Icon icon = ProjectUtilities.getIcon(project); - setIcon(isEnabled() ? icon : disabledIcon(icon)); + setIcon(isEnabled() ? icon : ImageUtilities.createDisabledIcon(icon)); setFont(Objects.equals(main, value) ? font.deriveFont(Font.BOLD) : font); } } - - private static Icon disabledIcon(Icon icon) { - return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); - } - } } diff --git a/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/structure/RustStructureItem.java b/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/structure/RustStructureItem.java index 8d109bbd9b55..3a3c3ae138c9 100644 --- a/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/structure/RustStructureItem.java +++ b/rust/rust.grammar/src/org/netbeans/modules/rust/grammar/structure/RustStructureItem.java @@ -71,7 +71,7 @@ public RustStructureItem(RustAST ast, RustASTNode node) { @Override public ImageIcon getCustomIcon() { - return new ImageIcon(ImageUtilities.loadImage(getIconBase(node))); + return ImageUtilities.loadImageIcon(getIconBase(node), false); } @Override diff --git a/rust/rust.options/src/org/netbeans/modules/rust/options/impl/CargoOptionsImpl.java b/rust/rust.options/src/org/netbeans/modules/rust/options/impl/CargoOptionsImpl.java index c4fad5c3e8df..ac71501ef80f 100644 --- a/rust/rust.options/src/org/netbeans/modules/rust/options/impl/CargoOptionsImpl.java +++ b/rust/rust.options/src/org/netbeans/modules/rust/options/impl/CargoOptionsImpl.java @@ -22,7 +22,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.prefs.Preferences; -import javax.swing.ImageIcon; +import javax.swing.Icon; import javax.swing.SwingUtilities; import org.netbeans.api.options.OptionsDisplayer; import org.netbeans.modules.rust.project.api.RustProjectAPI; @@ -139,7 +139,7 @@ public static void showCargoNotFoundNotification() { NotificationDisplayer.Priority priority = NotificationDisplayer.Priority.HIGH; String title = NbBundle.getMessage(CargoOptionsImpl.class, "MISSING_CARGO_TITLE"); // NOI18N String details = NbBundle.getMessage(CargoOptionsImpl.class, "MISSING_CARGO_DETAILS"); // NOI18N - ImageIcon icon = new ImageIcon(ImageUtilities.loadImage(RustProjectAPI.ICON)); + Icon icon = ImageUtilities.loadIcon(RustProjectAPI.ICON); NotificationDisplayer.getDefault().notify(title, icon, details, (actionEvent) -> { showRustCargoOptions(); }); diff --git a/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectFactory.java b/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectFactory.java index 6f14592c6c3b..7ca2f4ba2796 100644 --- a/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectFactory.java +++ b/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectFactory.java @@ -70,7 +70,7 @@ public ProjectManager.Result isProject2(FileObject projectDirectory) { if (src == null || !src.isFolder()) { return null; } - return new ProjectManager.Result(new ImageIcon(ImageUtilities.loadImage(RustProjectAPI.ICON))); + return new ProjectManager.Result(ImageUtilities.loadIcon(RustProjectAPI.ICON)); } @Override diff --git a/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectInformation.java b/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectInformation.java index d2eb52dd0cd7..f36bb57fbacb 100644 --- a/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectInformation.java +++ b/rust/rust.project/src/org/netbeans/modules/rust/project/RustProjectInformation.java @@ -22,7 +22,6 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.event.SwingPropertyChangeSupport; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectInformation; @@ -56,7 +55,7 @@ public String getDisplayName() { @Override public Icon getIcon() { - return new ImageIcon(ImageUtilities.loadImage(RustProjectAPI.ICON)); + return ImageUtilities.loadIcon(RustProjectAPI.ICON); } @Override diff --git a/rust/rust.project/src/org/netbeans/modules/rust/project/RustSourceGroup.java b/rust/rust.project/src/org/netbeans/modules/rust/project/RustSourceGroup.java index 7ee63ea36839..8cb81b92feaf 100644 --- a/rust/rust.project/src/org/netbeans/modules/rust/project/RustSourceGroup.java +++ b/rust/rust.project/src/org/netbeans/modules/rust/project/RustSourceGroup.java @@ -21,11 +21,11 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import javax.swing.Icon; -import javax.swing.ImageIcon; import org.netbeans.api.project.SourceGroup; import org.netbeans.modules.rust.project.api.RustIconFactory; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.util.ImageUtilities; /** * A RustSourceGroup represents a "folder" with sources, this is used for the @@ -63,7 +63,7 @@ public String getDisplayName() { @Override public Icon getIcon(boolean opened) { - return new ImageIcon(RustIconFactory.getSourceFolderIcon(opened)); + return ImageUtilities.image2Icon(RustIconFactory.getSourceFolderIcon(opened)); } @Override diff --git a/webcommon/html.angular/src/org/netbeans/modules/html/angular/editor/AngularJsCompletionItem.java b/webcommon/html.angular/src/org/netbeans/modules/html/angular/editor/AngularJsCompletionItem.java index 576315e9730b..442c974be9f3 100644 --- a/webcommon/html.angular/src/org/netbeans/modules/html/angular/editor/AngularJsCompletionItem.java +++ b/webcommon/html.angular/src/org/netbeans/modules/html/angular/editor/AngularJsCompletionItem.java @@ -78,7 +78,7 @@ public ElementKind getKind() { @Override public ImageIcon getIcon() { if (angularIcon == null) { - angularIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/html/angular/resources/AngularJS_icon_16.png")); //NOI18N + angularIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/html/angular/resources/AngularJS_icon_16.png", false); //NOI18N } return angularIcon; } diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsStructureScanner.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsStructureScanner.java index ada45d95fe88..500559378a47 100644 --- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsStructureScanner.java +++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsStructureScanner.java @@ -667,30 +667,30 @@ public String getName() { public ImageIcon getCustomIcon() { if (getFunctionScope().getJSKind() == JsElement.Kind.CALLBACK) { if (callbackIcon == null) { - callbackIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/editor/resources/methodCallback.png")); //NOI18N + callbackIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/editor/resources/methodCallback.png", false); //NOI18N } return callbackIcon; } else if (getFunctionScope().getJSKind() == JsElement.Kind.GENERATOR) { if (getModifiers().contains(Modifier.PUBLIC)) { if (publicGenerator == null) { - publicGenerator = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/editor/resources/generatorPublic.png")); //NOI18N + publicGenerator = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/editor/resources/generatorPublic.png", false); //NOI18N } return publicGenerator; } else if (getModifiers().contains(Modifier.PRIVATE)) { if (privateGenerator == null) { - privateGenerator = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/editor/resources/generatorPrivate.png")); //NOI18N + privateGenerator = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/editor/resources/generatorPrivate.png", false); //NOI18N } return privateGenerator; } else if (getModifiers().contains(Modifier.PROTECTED)) { if (priviligedGenerator == null) { - priviligedGenerator = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/editor/resources/generatorPriviliged.png")); //NOI18N + priviligedGenerator = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/editor/resources/generatorPriviliged.png", false); //NOI18N } return priviligedGenerator; } } if (getModifiers().contains(Modifier.PROTECTED)) { if(priviligedIcon == null) { - priviligedIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/editor/resources/methodPriviliged.png")); //NOI18N + priviligedIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/editor/resources/methodPriviliged.png", false); //NOI18N } return priviligedIcon; } diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/doc/JsDocumentationCodeCompletion.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/doc/JsDocumentationCodeCompletion.java index f45f03d725c9..8d5fd3b93017 100644 --- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/doc/JsDocumentationCodeCompletion.java +++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/doc/JsDocumentationCodeCompletion.java @@ -74,7 +74,7 @@ private static void completeAnnotation(JsCompletionItem.CompletionRequest reques public static class JsDocumentationCodeCompletionItem implements CompletionProposal { private static final String ANNOTATION_ICON = "org/netbeans/modules/csl/source/resources/icons/annotation.png"; //NOI18N - private static final ImageIcon IMAGE_ICON = new ImageIcon(ImageUtilities.loadImage(ANNOTATION_ICON)); + private static final ImageIcon IMAGE_ICON = ImageUtilities.loadImageIcon(ANNOTATION_ICON, false); private final AnnotationCompletionTag tag; private final int anchorOffset; diff --git a/webcommon/javascript2.html/src/org/netbeans/modules/javascript2/html/CssIdCompletionItem.java b/webcommon/javascript2.html/src/org/netbeans/modules/javascript2/html/CssIdCompletionItem.java index 994a58c13bc0..4a99ff98fa2e 100644 --- a/webcommon/javascript2.html/src/org/netbeans/modules/javascript2/html/CssIdCompletionItem.java +++ b/webcommon/javascript2.html/src/org/netbeans/modules/javascript2/html/CssIdCompletionItem.java @@ -82,7 +82,7 @@ public int getAnchorOffset() { @Override public ImageIcon getIcon() { if (cssIcon == null) { - cssIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/jquery/resources/style_sheet_16.png")); //NOI18N + cssIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/jquery/resources/style_sheet_16.png", false); //NOI18N } return cssIcon; } diff --git a/webcommon/javascript2.jade/src/org/netbeans/modules/javascript2/jade/editor/JadeCompletionItem.java b/webcommon/javascript2.jade/src/org/netbeans/modules/javascript2/jade/editor/JadeCompletionItem.java index 0a401061526f..bd31c6febb72 100644 --- a/webcommon/javascript2.jade/src/org/netbeans/modules/javascript2/jade/editor/JadeCompletionItem.java +++ b/webcommon/javascript2.jade/src/org/netbeans/modules/javascript2/jade/editor/JadeCompletionItem.java @@ -193,7 +193,7 @@ public String getRhsHtml(HtmlFormatter formatter) { @Override public ImageIcon getIcon() { if (keywordIcon == null) { - keywordIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/jade/resources/jade16.png")); //NOI18N + keywordIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/jade/resources/jade16.png", false); //NOI18N } return keywordIcon; } diff --git a/webcommon/javascript2.jquery/src/org/netbeans/modules/javascript2/jquery/editor/JQueryCompletionItem.java b/webcommon/javascript2.jquery/src/org/netbeans/modules/javascript2/jquery/editor/JQueryCompletionItem.java index 501b68f37f72..39607934ee51 100644 --- a/webcommon/javascript2.jquery/src/org/netbeans/modules/javascript2/jquery/editor/JQueryCompletionItem.java +++ b/webcommon/javascript2.jquery/src/org/netbeans/modules/javascript2/jquery/editor/JQueryCompletionItem.java @@ -176,7 +176,7 @@ public CssCompletionItem(ElementHandle element, int anchorOffset, String surroun @Override public ImageIcon getIcon() { if (cssIcon == null) { - cssIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/jquery/resources/style_sheet_16.png")); //NOI18N + cssIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/jquery/resources/style_sheet_16.png", false); //NOI18N } return cssIcon; } @@ -227,7 +227,7 @@ public String getCustomInsertTemplate() { @Override public ImageIcon getIcon() { if (jQIcon == null) { - jQIcon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/javascript2/jquery/resources/jquery_16_2.png")); //NOI18N + jQIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/javascript2/jquery/resources/jquery_16_2.png", false); //NOI18N } return jQIcon; } diff --git a/webcommon/javascript2.nodejs/src/org/netbeans/modules/javascript2/nodejs/editor/NodeJsUtils.java b/webcommon/javascript2.nodejs/src/org/netbeans/modules/javascript2/nodejs/editor/NodeJsUtils.java index 80cb8a63f31e..0e8821fba1b0 100644 --- a/webcommon/javascript2.nodejs/src/org/netbeans/modules/javascript2/nodejs/editor/NodeJsUtils.java +++ b/webcommon/javascript2.nodejs/src/org/netbeans/modules/javascript2/nodejs/editor/NodeJsUtils.java @@ -65,7 +65,7 @@ public class NodeJsUtils { public static ImageIcon getNodeJsIcon () { if (NODEJS_ICON == null) { - NODEJS_ICON = new ImageIcon(ImageUtilities.loadImage(NODEJS_ICON_PATH)); //NOI18N + NODEJS_ICON = ImageUtilities.loadImageIcon(NODEJS_ICON_PATH, false); //NOI18N } return NODEJS_ICON; } diff --git a/webcommon/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/EditorUtils.java b/webcommon/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/EditorUtils.java index afbaba4eb112..05fef3abb227 100644 --- a/webcommon/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/EditorUtils.java +++ b/webcommon/javascript2.requirejs/src/org/netbeans/modules/javascript2/requirejs/editor/EditorUtils.java @@ -50,7 +50,7 @@ public class EditorUtils { public static ImageIcon getRequireJsIcon () { if (REQUIREJS_ICON == null) { - REQUIREJS_ICON = new ImageIcon(ImageUtilities.loadImage(REQUIRE_JS_ICON_PATH)); //NOI18N + REQUIREJS_ICON = ImageUtilities.loadImageIcon(REQUIRE_JS_ICON_PATH, false); //NOI18N } return REQUIREJS_ICON; } diff --git a/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/browser/ActiveBrowserAction.java b/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/browser/ActiveBrowserAction.java index 81f23da8f06f..e2287e9bc919 100644 --- a/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/browser/ActiveBrowserAction.java +++ b/webcommon/web.clientproject.api/src/org/netbeans/modules/web/clientproject/browser/ActiveBrowserAction.java @@ -380,9 +380,9 @@ private void updateButton(ProjectBrowserProvider pbp) { private Icon badgeWithArrowIcon(Image im) { // #235642 assert im != null : "Image must be provided"; - return ImageUtilities.image2Icon(ImageUtilities.mergeImages(im, - ImageUtilities.icon2Image(DropDownButtonFactory.getArrowIcon(false)), - isSmallToolbarIcon() ? 20 : 28, isSmallToolbarIcon() ? 6 : 10)); // NOI18N + return ImageUtilities.mergeIcons(ImageUtilities.image2Icon(im), + DropDownButtonFactory.getArrowIcon(false), + isSmallToolbarIcon() ? 20 : 28, isSmallToolbarIcon() ? 6 : 10); // NOI18N } private void showBrowserPickerPopup( JButton invoker ) { diff --git a/webcommon/web.clientproject/src/org/netbeans/modules/web/clientproject/ClientSideProject.java b/webcommon/web.clientproject/src/org/netbeans/modules/web/clientproject/ClientSideProject.java index c2cf84b9c90d..a80c376ec134 100644 --- a/webcommon/web.clientproject/src/org/netbeans/modules/web/clientproject/ClientSideProject.java +++ b/webcommon/web.clientproject/src/org/netbeans/modules/web/clientproject/ClientSideProject.java @@ -597,7 +597,7 @@ public String getDisplayName() { @Override public Icon getIcon() { - return new ImageIcon(ImageUtilities.loadImage(ClientSideProject.HTML5_PROJECT_ICON)); + return ImageUtilities.loadIcon(ClientSideProject.HTML5_PROJECT_ICON); } @Override diff --git a/webcommon/web.inspect/src/org/netbeans/modules/web/inspect/ui/DomPanel.java b/webcommon/web.inspect/src/org/netbeans/modules/web/inspect/ui/DomPanel.java index 0c89ab732478..a28562e9056c 100644 --- a/webcommon/web.inspect/src/org/netbeans/modules/web/inspect/ui/DomPanel.java +++ b/webcommon/web.inspect/src/org/netbeans/modules/web/inspect/ui/DomPanel.java @@ -306,7 +306,7 @@ public Dimension getMinimumSize() { if (image == null) { icon = lookup.lookup(Icon.class); } else { - icon = new ImageIcon(image); + icon = ImageUtilities.image2Icon(image); } if (icon == null) { BrowserFamilyId id = lookup.lookup(BrowserFamilyId.class); @@ -315,7 +315,7 @@ public Dimension getMinimumSize() { if (browser.hasNetBeansIntegration() && (id == browser.getBrowserFamily())) { image = browser.getIconImage(true); if (image != null) { - icon = new ImageIcon(image); + icon = ImageUtilities.image2Icon(image); break; } }