Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.KeyStroke;
import javax.swing.border.Border;
Expand Down Expand Up @@ -76,7 +77,6 @@
import org.netbeans.modules.web.jsf.navigation.graph.layout.ConnectionWrapperLayout;
import org.openide.actions.DeleteAction;
import org.openide.util.ImageUtilities;
import org.openide.util.Utilities;
import org.openide.util.actions.CallbackSystemAction;
import org.openide.util.actions.SystemAction;

Expand Down Expand Up @@ -125,12 +125,12 @@ public class PageFlowScene extends GraphPinScene<Page, NavigationCaseEdge, Pin>
private PFObjectSceneListener pfObjectSceneListener;
private static Paint PAINT_BACKGROUND;
static {
Image sourceImage = ImageUtilities.loadImage("org/netbeans/modules/web/jsf/navigation/graph/resources/paper_grid.png"); // NOI18N
int width = sourceImage.getWidth(null);
int height = sourceImage.getHeight(null);
Icon sourceIcon = ImageUtilities.loadIcon("org/netbeans/modules/web/jsf/navigation/graph/resources/paper_grid.png"); // NOI18N
int width = sourceIcon.getIconWidth();
int height = sourceIcon.getIconHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
graphics.drawImage(sourceImage, 0, 0, null);
sourceIcon.paintIcon(null, graphics, 0, 0);
graphics.dispose();
PAINT_BACKGROUND = new TexturePaint(image, new Rectangle(0, 0, width, height));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultRowSorter;
import javax.swing.ImageIcon;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
Expand Down Expand Up @@ -237,7 +237,7 @@ public void actionPerformed(ActionEvent e) {
dataPanelScrollPane.setRowHeaderView(rowHeader);
dataPanelScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, rowHeader.getTableHeader());

ImageIcon icon = ImageUtilities.loadImageIcon(IMG_PREFIX + "preferences-desktop.png", false); // NOI18N
Icon icon = ImageUtilities.loadIcon(IMG_PREFIX + "preferences-desktop.png", false); // NOI18N
JButton cornerButton = new JButton() {
@Override
protected void paintComponent(Graphics g) {
Expand All @@ -247,7 +247,7 @@ protected void paintComponent(Graphics g) {
g2d.setColor(getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawImage(icon.getImage(), (getWidth() - iconSize) / 2, (getHeight() - iconSize) / 2, iconSize, iconSize, null);
icon.paintIcon(null, g2d, (getWidth() - iconSize) / 2, (getHeight() - iconSize) / 2);
}
};
cornerButton.addActionListener(popupActionListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.*;
import java.util.List;
import org.openide.awt.GraphicsUtils;
import org.openide.util.ImageUtilities;

/**
* Split pane divider with Diff decorations.
Expand All @@ -43,8 +44,8 @@
*/
class DiffSplitPaneDivider extends BasicSplitPaneDivider implements MouseMotionListener, MouseListener, Accessible {

private final Image insertAllImage = org.openide.util.Utilities.loadImage("org/netbeans/modules/diff/builtin/visualizer/editable/move_all.png"); // NOI18N
private final Image insertAllActiveImage = org.openide.util.Utilities.loadImage("org/netbeans/modules/diff/builtin/visualizer/editable/move_all_active.png"); // NOI18N
private final Icon insertAllIcon = ImageUtilities.loadIcon("org/netbeans/modules/diff/builtin/visualizer/editable/move_all.png"); // NOI18N
private final Icon insertAllActiveIcon = ImageUtilities.loadIcon("org/netbeans/modules/diff/builtin/visualizer/editable/move_all_active.png"); // NOI18N
private final int actionIconsHeight;
private final int actionIconsWidth;
private final Point POINT_ZERO = new Point(0, 0);
Expand All @@ -64,8 +65,8 @@ class DiffSplitPaneDivider extends BasicSplitPaneDivider implements MouseMotionL
this.master = master;
fontColor = new JLabel().getForeground();

actionIconsHeight = insertAllImage.getHeight(this);
actionIconsWidth = insertAllImage.getWidth(this);
actionIconsHeight = insertAllIcon.getIconHeight();
actionIconsWidth = insertAllIcon.getIconWidth();

setBorder(null);
setLayout(new BorderLayout());
Expand Down Expand Up @@ -254,9 +255,9 @@ protected void paintComponent(Graphics gr) {
if (master.isActionsEnabled() && everythingEditable) {
hotSpot = new Rectangle((getWidth() - actionIconsWidth) /2, editorsOffset, actionIconsWidth, actionIconsHeight);
if (hotSpot.contains(lastMousePosition)) {
g.drawImage(insertAllActiveImage, hotSpot.x, hotSpot.y, this);
insertAllActiveIcon.paintIcon(null, g, hotSpot.x, hotSpot.y);
} else {
g.drawImage(insertAllImage, hotSpot.x, hotSpot.y, this);
insertAllIcon.paintIcon(null, g, hotSpot.x, hotSpot.y);
}
rollbackAction.initRect(hotSpot);
newActionIcons.add(rollbackAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Stroke;
Expand All @@ -43,6 +42,7 @@
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Map;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.Scrollable;
import javax.swing.SwingUtilities;
Expand All @@ -59,6 +59,7 @@
import org.netbeans.editor.EditorUI;
import org.netbeans.editor.Utilities;
import org.netbeans.lib.editor.util.swing.DocumentUtilities;
import org.openide.util.ImageUtilities;

/**
* Draws both line numbers and diff actions for a decorated editor pane.
Expand All @@ -71,11 +72,11 @@ class LineNumbersActionsBar extends JPanel implements Scrollable, MouseMotionLis
private static final int LINES_BORDER_WIDTH = 4;
private static final Point POINT_ZERO = new Point(0, 0);

private final Image insertImage = org.openide.util.Utilities.loadImage("org/netbeans/modules/diff/builtin/visualizer/editable/insert.png"); // NOI18N
private final Image removeImage = org.openide.util.Utilities.loadImage("org/netbeans/modules/diff/builtin/visualizer/editable/remove.png"); // NOI18N
private final Icon insertIcon = ImageUtilities.loadIcon("org/netbeans/modules/diff/builtin/visualizer/editable/insert.png"); // NOI18N
private final Icon removeIcon = ImageUtilities.loadIcon("org/netbeans/modules/diff/builtin/visualizer/editable/remove.png"); // NOI18N

private final Image insertActiveImage = org.openide.util.Utilities.loadImage("org/netbeans/modules/diff/builtin/visualizer/editable/insert_active.png"); // NOI18N
private final Image removeActiveImage = org.openide.util.Utilities.loadImage("org/netbeans/modules/diff/builtin/visualizer/editable/remove_active.png"); // NOI18N
private final Icon insertActiveIcon = ImageUtilities.loadIcon("org/netbeans/modules/diff/builtin/visualizer/editable/insert_active.png"); // NOI18N
private final Icon removeActiveIcon = ImageUtilities.loadIcon("org/netbeans/modules/diff/builtin/visualizer/editable/remove_active.png"); // NOI18N

private final DiffContentPanel master;
private final boolean actionsEnabled;
Expand All @@ -100,8 +101,8 @@ public LineNumbersActionsBar(DiffContentPanel master, boolean actionsEnabled) {
this.master = master;
this.actionsEnabled = actionsEnabled;
actionsWidth = actionsEnabled ? ACTIONS_BAR_WIDTH : 0;
actionIconsHeight = insertImage.getHeight(this);
actionIconsWidth = insertImage.getWidth(this);
actionIconsHeight = insertIcon.getIconHeight();
actionIconsWidth = insertIcon.getIconWidth();
setOpaque(true);
setToolTipText(""); // NOI18N
master.getMaster().addPropertyChangeListener(this);
Expand Down Expand Up @@ -340,13 +341,13 @@ protected void paintComponent(Graphics gr) {
if (actionsEnabled && dd.canRollback()) {
if (master.isFirst() && dd.getDiff().getType() != Difference.ADD
|| !master.isFirst() && dd.getDiff().getType() == Difference.ADD) {
Image activeImage = master.isFirst() ? insertActiveImage : removeActiveImage;
Image image = master.isFirst() ? insertImage : removeImage;
Icon activeIcon = master.isFirst() ? insertActiveIcon : removeActiveIcon;
Icon icon = master.isFirst() ? insertIcon : removeIcon;
Rectangle hotSpot = new Rectangle((master.isFirst() ? 0 : offset) + 1, top + actionsYOffset, actionIconsWidth, actionIconsHeight);
if (hotSpot.contains(lastMousePosition) || idx == currentDifference) {
g.drawImage(activeImage, hotSpot.x, hotSpot.y, this);
activeIcon.paintIcon(null, g, hotSpot.x, hotSpot.y);
} else {
g.drawImage(image, hotSpot.x, hotSpot.y, this);
icon.paintIcon(null, g, hotSpot.x, hotSpot.y);
}
newActionIcons.add(new HotSpot(hotSpot, dd.getDiff()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class CompletionJList extends JList {

private static final int DARKER_COLOR_COMPONENT = 5;
private static final int SUB_MENU_ICON_GAP = 1;
private static final ImageIcon subMenuIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/editor/completion/resources/suggestion.png", false); // NOI18N
private static final Icon subMenuIcon = ImageUtilities.loadIcon("org/netbeans/modules/editor/completion/resources/suggestion.png", false); // NOI18N

private final RenderComponent renderComponent;

Expand Down Expand Up @@ -345,7 +345,7 @@ void setSeparator(boolean separator) {
item.render(g, CompletionJList.this.getFont(), getForeground(), bgColor,
itemRenderWidth, getHeight(), selected);
if (selected && item instanceof CompositeCompletionItem && !((CompositeCompletionItem)item).getSubItems().isEmpty()) {
g.drawImage(subMenuIcon.getImage(), itemRenderWidth - subMenuIcon.getIconWidth() - SUB_MENU_ICON_GAP, (height - subMenuIcon.getIconHeight()) / 2, null);
subMenuIcon.paintIcon(null, g, itemRenderWidth - subMenuIcon.getIconWidth() - SUB_MENU_ICON_GAP, (height - subMenuIcon.getIconHeight()) / 2);
}

if (separator) {
Expand Down
21 changes: 9 additions & 12 deletions ide/editor.lib/src/org/netbeans/editor/GlyphGutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.util.prefs.Preferences;
import javax.swing.Action;
import javax.accessibility.*;
import javax.swing.Icon;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.text.AbstractDocument;
Expand Down Expand Up @@ -99,7 +100,7 @@ public class GlyphGutter extends JComponent implements Annotations.AnnotationsLi
private Annotations annos;

/** Cycling button image */
private Image gutterButton;
private Icon gutterButton;

/** Background color of the gutter */
private Color backgroundColor;
Expand Down Expand Up @@ -252,7 +253,7 @@ protected void init() {
if (editorUI == null)
return ;

gutterButton = ImageUtilities.icon2Image(ImageUtilities.loadImageIcon("org/netbeans/editor/resources/glyphbutton.gif", false));
gutterButton = ImageUtilities.loadIcon("org/netbeans/editor/resources/glyphbutton.gif", false);

setToolTipText ("");
getAccessibleContext().setAccessibleName(NbBundle.getBundle(BaseKit.class).getString("ACSN_Glyph_Gutter")); // NOI18N
Expand Down Expand Up @@ -601,22 +602,18 @@ public void run() {
// draw the glyph only when the annotation type has its own icon (no the default one)
// or in case there is more than one annotations on the line
if (!(annoCount == 1 && annoDesc.isDefaultGlyph())) {
g.drawImage(
annoGlyph,
// Draw as Icon to get full resolution for SVG icons.
Icon annoGlyphIcon = ImageUtilities.image2Icon(annoGlyph);
annoGlyphIcon.paintIcon(null, g,
xPos,
(int) Math.round(pViewRect.y + (rowHeight - glyphHeight) / 2 + 1),
null
);
(int) Math.round(pViewRect.y + (rowHeight - glyphHeight) / 2 + 1));
}

// draw cycling button if there is more than one annotations on the line
if (annoCount > 1) {
g.drawImage(
gutterButton,
gutterButton.paintIcon(null, g,
xPos + glyphWidth - 1,
(int) Math.round(pViewRect.y + (rowHeight - glyphHeight) / 2),
null
);
(int) Math.round(pViewRect.y + (rowHeight - glyphHeight) / 2));
}
}
lineWithAnno = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.awt.Rectangle;
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.text.View;
import org.netbeans.editor.Analyzer;
Expand All @@ -37,6 +38,7 @@
import org.netbeans.editor.Annotations;
import org.netbeans.editor.FontMetricsCache;
import org.netbeans.editor.PrintContainer;
import org.openide.util.ImageUtilities;

/** Draw graphics functions as abstraction over various kinds of drawing. It's used
* for drawing into classic graphics, printing and measuring.
Expand Down Expand Up @@ -587,8 +589,9 @@ private void flush(boolean atEOL) {
graphics.setClip(clip);

for (int i=0; i < passiveAnnosAtY.length; i++) {
g2d.drawImage(passiveAnnosAtY[i].getGlyph(), glyphX, y, null);
glyphX += passiveAnnosAtY[i].getGlyph().getWidth(null)+1;
Icon glyphIcon = ImageUtilities.image2Icon(passiveAnnosAtY[i].getGlyph());
glyphIcon.paintIcon(null, g2d, glyphX, y);
glyphX += glyphIcon.getIconWidth() + 1;
}

// restore original clip region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,7 @@ public static int arrowSpan() {
private void renderHtml(Fix f, Graphics g, Font defaultFont, Color defaultColor,
int width, int height, boolean selected) {
if (icon != null) {
// The image of the ImageIcon should already be loaded
// so no ImageObserver should be necessary
g.drawImage(ImageUtilities.icon2Image(icon), BEFORE_ICON_GAP, (height - icon.getIconHeight()) /2, this);
icon.paintIcon(null, g, BEFORE_ICON_GAP, (height - icon.getIconHeight()) /2);
}
int iconWidth = BEFORE_ICON_GAP + icon.getIconWidth() + AFTER_ICON_GAP;
int textEnd = width - AFTER_ICON_GAP - subMenuIcon.getIconWidth() - AFTER_TEXT_GAP;
Expand Down
28 changes: 14 additions & 14 deletions java/form/src/org/netbeans/modules/form/HandleLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class HandleLayer extends JPanel implements MouseListener, MouseMotionLis
private boolean draggingSuspended;

private SelectionDragger selectionDragger;
private Image resizeHandle;
private Icon resizeHandle;

private DropTarget dropTarget;
private DropTargetListener dropListener;
Expand Down Expand Up @@ -356,32 +356,32 @@ private void paintSelection(Graphics2D g, RADComponent metacomp, boolean inLayou
g.drawRect(x, y, width, height);
g.setStroke(oldStroke);
if (inLayout) {
Image resizeHandle = resizeHandle();
int iconHeight = resizeHandle.getHeight(null);
int iconWidth = resizeHandle.getWidth(null);
Icon resizeHandle = resizeHandle();
int iconHeight = resizeHandle.getIconHeight();
int iconWidth = resizeHandle.getIconWidth();
if ((resizable & LayoutSupportManager.RESIZE_LEFT) != 0) {
g.drawImage(resizeHandle, x-iconWidth+1, y+(height-iconHeight)/2, null);
resizeHandle.paintIcon(null, g, x-iconWidth+1, y+(height-iconHeight)/2);
if ((resizable & LayoutSupportManager.RESIZE_UP) != 0) {
g.drawImage(resizeHandle, x-iconWidth+1, y-iconHeight+1, null);
resizeHandle.paintIcon(null, g, x-iconWidth+1, y-iconHeight+1);
}
if ((resizable & LayoutSupportManager.RESIZE_DOWN) != 0) {
g.drawImage(resizeHandle, x-iconWidth+1, y+height, null);
resizeHandle.paintIcon(null, g, x-iconWidth+1, y+height);
}
}
if ((resizable & LayoutSupportManager.RESIZE_RIGHT) != 0) {
g.drawImage(resizeHandle, x+width, y+(height-iconHeight)/2, null);
resizeHandle.paintIcon(null, g, x+width, y+(height-iconHeight)/2);
if ((resizable & LayoutSupportManager.RESIZE_UP) != 0) {
g.drawImage(resizeHandle, x+width, y-iconHeight+1, null);
resizeHandle.paintIcon(null, g, x+width, y-iconHeight+1);
}
if ((resizable & LayoutSupportManager.RESIZE_DOWN) != 0) {
g.drawImage(resizeHandle, x+width, y+height, null);
resizeHandle.paintIcon(null, g, x+width, y+height);
}
}
if ((resizable & LayoutSupportManager.RESIZE_UP) != 0) {
g.drawImage(resizeHandle, x+(width-iconWidth)/2, y-iconHeight+1, null);
resizeHandle.paintIcon(null, g, x+(width-iconWidth)/2, y-iconHeight+1);
}
if ((resizable & LayoutSupportManager.RESIZE_DOWN) != 0) {
g.drawImage(resizeHandle, x+(width-iconWidth)/2, y+height, null);
resizeHandle.paintIcon(null, g, x+(width-iconWidth)/2, y+height);
}
}
}
Expand Down Expand Up @@ -701,9 +701,9 @@ private void paintButtonGroupInsertCount(SortedMap<Integer, int[]> bounds, int v
counts[start ? 0 : 1]++;
}

private Image resizeHandle() {
private Icon resizeHandle() {
if (resizeHandle == null) {
resizeHandle = ImageUtilities.loadImageIcon("org/netbeans/modules/form/resources/resize_handle.png", false).getImage(); // NOI18N
resizeHandle = ImageUtilities.loadIcon("org/netbeans/modules/form/resources/resize_handle.png", false); // NOI18N
}
return resizeHandle;
}
Expand Down
Loading
Loading