本文整理了Java中org.openide.util.Utilities.mergeImages()
方法的一些代码示例,展示了Utilities.mergeImages()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.mergeImages()
方法的具体详情如下:
包路径:org.openide.util.Utilities
类名称:Utilities
方法名:mergeImages
[英]This method merges two images into the new one. The second image is drawn over the first one with its top-left corner at x, y. Images need not be of the same size. New image will have a size of max(second image size + top-left corner, first image size). Method is used mostly when second image contains transparent pixels (e.g. for badging).
[中]此方法将两个图像合并到新图像中。第二个图像绘制在第一个图像上,其左上角位于x,y。图像的大小不必相同。新图像的最大大小(第二个图像大小+左上角,第一个图像大小)。当第二幅图像包含透明像素时(例如用于标记),通常使用该方法。
代码示例来源:origin: org.codehaus.mevenide/nb-repo-browser
@Override
public java.awt.Image getIcon(int param) {
java.awt.Image retValue = super.getIcon(param);
if (hasJavadoc) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/repository/DependencyJavadocIncluded.png"),//NOI18N
12, 12);
}
if (hasSources) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/repository/DependencySrcIncluded.png"),//NOI18N
12, 8);
}
return retValue;
}
代码示例来源:origin: org.codehaus.mevenide/nb-repo-browser
@Override
public java.awt.Image getIcon(int param) {
java.awt.Image retValue = super.getIcon(param);
if (hasJavadoc) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/repository/DependencyJavadocIncluded.png"),//NOI18N
12, 12);
}
if (hasSources) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/repository/DependencySrcIncluded.png"),//NOI18N
12, 8);
}
return retValue;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public Image getIconImpl(int param) {
//HACK - 1. getImage call
// 2. assume project root folder, should be Generic Sources root (but is the same)
Image img = ((ImageIcon)info.getIcon()).getImage();
if (reporter.getReports().size() > 0) {
img = Utilities.mergeImages(img, Utilities.loadImage("org/codehaus/mevenide/netbeans/brokenProjectBadge.png"), 8, 0);//NOI18N
}
return img;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public Image getOpenedIcon(int param) {
Image retValue = Utilities.mergeImages(getTreeFolderIcon(true),
Utilities.loadImage("org/codehaus/mevenide/netbeans/libraries-badge.png"), //NOI18N
8, 8);
return retValue;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
/**
* Returns cursor created from given icon.
*/
private static Cursor createCustomCursor(Image icon, String name) {
Toolkit t = Toolkit.getDefaultToolkit();
Dimension d = t.getBestCursorSize(16, 16);
Image i = icon;
if (d.width != icon.getWidth(null)) {
// need to resize the icon
Image empty = createBufferedImage(d.width, d.height);
i = Utilities.mergeImages(icon, empty, 0, 0);
}
return t.createCustomCursor(i, new Point(11,9), name);
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public Image getOpenedIconImpl(int param) {
//HACK - 1. getImage call
// 2. assume project root folder, should be Generic Sources root (but is the same)
Image img = ((ImageIcon)info.getIcon()).getImage();
if (reporter.getReports().size() > 0) {
img = Utilities.mergeImages(img, Utilities.loadImage("org/codehaus/mevenide/netbeans/brokenProjectBadge.png"), 8, 0);//NOI18N
}
return img;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public Image getIcon(int param) {
Image retValue = Utilities.mergeImages(getTreeFolderIcon(false),
Utilities.loadImage("org/codehaus/mevenide/netbeans/libraries-badge.png"), //NOI18N
8, 8);
return retValue;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public java.awt.Image getOpenedIcon(int param) {
java.awt.Image retValue = super.getOpenedIcon(param);
if (isTopLevelNode) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/projectsite-badge.png"), //NOI18N
8, 8);
}
return retValue;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
/**
* Returns cursor created from given icon.
*/
private static Cursor createCustomCursor(Image icon, String name) {
Toolkit t = Toolkit.getDefaultToolkit();
Dimension d = t.getBestCursorSize(16, 16);
Image i = icon;
if (d.width != icon.getWidth(null)) {
// need to resize the icon
Image empty = createBufferedImage(d.width, d.height);
i = Utilities.mergeImages(icon, empty, 0, 0);
}
return t.createCustomCursor(i, new Point(11,9), name);
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public java.awt.Image getIcon(int param) {
java.awt.Image retValue = super.getIcon(param);
if (isTopLevelNode) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/projectsite-badge.png"), //NOI18N
8, 8);
}
return retValue;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
private Image getIcon(boolean opened) {
Image badge = Utilities.loadImage("org/codehaus/mevenide/netbeans/projectfiles-badge.png", true); //NOI18N
Image img = Utilities.mergeImages(NodeUtils.getTreeFolderIcon(opened), badge, 8, 8);
return img;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
private Image getIcon(boolean opened) {
Image badge = Utilities.loadImage("org/codehaus/mevenide/netbeans/modules-badge.png", true); //NOI18N
return Utilities.mergeImages(NodeUtils.getTreeFolderIcon(opened), badge, 8, 8);
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
private Image getIcon(boolean opened) {
Image badge = Utilities.loadImage("org/codehaus/mevenide/netbeans/others-badge.png", true); //NOI18N
return Utilities.mergeImages(NodeUtils.getTreeFolderIcon(opened), badge, 8, 8);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
private static Cursor createCustomCursor(Component component, Image icon, String name) {
Toolkit t = component.getToolkit();
Dimension d = t.getBestCursorSize(16, 16);
Image i = icon;
if (d.width != icon.getWidth(null)) {
if ((d.width) == 0 && (d.height == 0)) {
// system doesn't support custom cursors, falling back
return Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
}
// need to resize the icon
Image empty = IconManager.createBufferedImage(d.width, d.height);
i = Utilities.mergeImages(icon, empty, 0, 0);
}
return t.createCustomCursor(i, new Point(1,1), name);
}
代码示例来源:origin: in.jlibs/org-openide-util
public static Cursor createCustomCursor(Component component, Image icon, String name) {
Toolkit t = component.getToolkit();
Dimension d = t.getBestCursorSize(16, 16);
Image i = icon;
if (d.width != icon.getWidth(null)) {
if (((d.width) == 0) && (d.height == 0)) {
// system doesn't support custom cursors, falling back
return Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
}
// need to resize the icon
Image empty = ImageUtilities.createBufferedImage(d.width, d.height);
i = Utilities.mergeImages(icon, empty, 0, 0);
}
return t.createCustomCursor(i, new Point(1, 1), name);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
private static Cursor createCustomCursor(Component component, Image icon, String name) {
Toolkit t = component.getToolkit();
Dimension d = t.getBestCursorSize(16, 16);
Image i = icon;
if (d.width != icon.getWidth(null)) {
if ((d.width) == 0 && (d.height == 0)) {
// system doesn't support custom cursors, falling back
return Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
}
// need to resize the icon
Image empty = IconManager.createBufferedImage(d.width, d.height);
i = Utilities.mergeImages(icon, empty, 0, 0);
}
return t.createCustomCursor(i, new Point(1,1), name);
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public Image getIcon(int param) {
Image retValue;
retValue = super.getIcon(param);
if (isLocal()) {
if (hasJavadocInRepository()) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/DependencyJavadocIncluded.png"), //NOI18N
12, 0);
}
if (hasSourceInRepository()) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/DependencySrcIncluded.png"), //NOI18N
12, 8);
}
return retValue;
} else {
return Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/ResourceNotIncluded.gif"), //NOI18N
0, 0);
}
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
@Override
public Image getOpenedIcon(int type) {
Image retValue;
retValue = super.getOpenedIcon(type);
if (isLocal()) {
if (hasJavadocInRepository()) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/DependencyJavadocIncluded.png"), //NOI18N
12, 0);
}
if (hasSourceInRepository()) {
retValue = Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/DependencySrcIncluded.png"), //NOI18N
12, 8);
}
return retValue;
} else {
return Utilities.mergeImages(retValue,
Utilities.loadImage("org/codehaus/mevenide/netbeans/ResourceNotIncluded.gif"), //NOI18N
0,0);
}
}
内容来源于网络,如有侵权,请联系作者删除!