本文整理汇总了Java中java.awt.Image.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Image.getProperty方法的具体用法?Java Image.getProperty怎么用?Java Image.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Image
的用法示例。
在下文中一共展示了Image.getProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNew
import java.awt.Image; //导入方法依赖的package包/类
public static ToolTipImage createNew(String toolTipText, Image image, URL url) {
ImageUtilities.ensureLoaded(image);
boolean bitmask = (image instanceof Transparency) && ((Transparency) image).getTransparency() != Transparency.TRANSLUCENT;
ColorModel model = colorModel(bitmask ? Transparency.BITMASK : Transparency.TRANSLUCENT);
int w = image.getWidth(null);
int h = image.getHeight(null);
if (url == null) {
Object value = image.getProperty("url", null);
url = (value instanceof URL) ? (URL) value : null;
}
ToolTipImage newImage = new ToolTipImage(
toolTipText,
model,
model.createCompatibleWritableRaster(w, h),
model.isAlphaPremultiplied(), null, url
);
java.awt.Graphics g = newImage.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
return newImage;
}
示例2: prefferImage
import java.awt.Image; //导入方法依赖的package包/类
private Image prefferImage(Image computed, Image parent, int type) {
if (computed == null) {
return parent;
}
if (!ALWAYS_PREFFER_COMPUTED_ICON) {
final Object attrValue = parent.getProperty("url", null); //NOI18N
if (attrValue instanceof URL) {
final String url = attrValue.toString();
if (!(isJavaSource ? url.endsWith(JAVA_ICON_BASE) : url.endsWith(CLASS_ICON_BASE))) {
return parent;
}
}
}
try {
final FileObject fo = getDataObject().getPrimaryFile ();
computed = FileUIUtils.getImageDecorator(fo.getFileSystem ()).annotateIcon (
computed,
type,
Collections.singleton(fo));
} catch (FileStateInvalidException e) {
// no fs, do nothing
}
return computed;
}
示例3: doMergeImages
import java.awt.Image; //导入方法依赖的package包/类
private static final Image doMergeImages(Image image1, Image image2, int x, int y) {
ensureLoaded(image1);
ensureLoaded(image2);
int w = Math.max(image1.getWidth(null), x + image2.getWidth(null));
int h = Math.max(image1.getHeight(null), y + image2.getHeight(null));
boolean bitmask = (image1 instanceof Transparency) && ((Transparency)image1).getTransparency() != Transparency.TRANSLUCENT
&& (image2 instanceof Transparency) && ((Transparency)image2).getTransparency() != Transparency.TRANSLUCENT;
StringBuilder str = new StringBuilder(image1 instanceof ToolTipImage ? ((ToolTipImage)image1).toolTipText : "");
if (image2 instanceof ToolTipImage) {
String toolTip = ((ToolTipImage)image2).toolTipText;
if (str.length() > 0 && toolTip.length() > 0) {
str.append(TOOLTIP_SEPAR);
}
str.append(toolTip);
}
Object firstUrl = image1.getProperty("url", null);
ColorModel model = colorModel(bitmask? Transparency.BITMASK: Transparency.TRANSLUCENT);
ToolTipImage buffImage = new ToolTipImage(str.toString(),
model, model.createCompatibleWritableRaster(w, h), model.isAlphaPremultiplied(), null, firstUrl instanceof URL ? (URL)firstUrl : null
);
java.awt.Graphics g = buffImage.createGraphics();
g.drawImage(image1, 0, 0, null);
g.drawImage(image2, x, y, null);
g.dispose();
return buffImage;
}
示例4: main
import java.awt.Image; //导入方法依赖的package包/类
public static void main(String[] args) {
Image image = new TestMultiResolutionCachedImage(100);
image.getWidth(null);
image.getHeight(null);
image.getProperty("comment", null);
int scaledSize = 50;
Image scaledImage = image.getScaledInstance(scaledSize, scaledSize,
Image.SCALE_SMOOTH);
if (!(scaledImage instanceof BufferedImage)) {
throw new RuntimeException("Wrong scaled image!");
}
BufferedImage buffScaledImage = (BufferedImage) scaledImage;
if (buffScaledImage.getWidth() != scaledSize
|| buffScaledImage.getHeight() != scaledSize) {
throw new RuntimeException("Wrong scaled image!");
}
if (buffScaledImage.getRGB(scaledSize / 2, scaledSize / 2) != TEST_COLOR.getRGB()) {
throw new RuntimeException("Wrong scaled image!");
}
}
示例5: buildUnitText
import java.awt.Image; //导入方法依赖的package包/类
private void buildUnitText(Unit u, StringBuilder text, boolean collectDependencies) {
if (u instanceof Unit.Available) {
Unit.Available u1 = (Unit.Available) u;
Image c = u1.getSourceIcon();
Object url = c.getProperty("url", null);
String categoryName = u1.getSourceDescription();
text.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
if (url instanceof URL) {
text.append("<td><img src=\"").append(url).append("\"></img></td>");
}
text.append("<td></td>");
text.append("<td> </td>");
text.append("<td><b>").append(categoryName).append("</b></td>");
text.append("</tr></table><br>");
}
if (Utilities.modulesOnly() || Utilities.showExtendedDescription()) {
text.append("<b>").append(getBundle("UnitDetails_Plugin_CodeName")).append("</b>").append(u.updateUnit.getCodeName()); // NOI18N
text.append("<br>");
}
String desc = null;
if (u instanceof Unit.Update) {
Unit.Update uu = ((Unit.Update) u);
text.append("<b>").append(getBundle("UnitDetails_Plugin_InstalledVersion")).append("</b>").append(uu.getInstalledVersion()).append("<br>"); // NOI18N
text.append("<b>").append(getBundle("UnitDetails_Plugin_AvailableVersion")).append("</b>").append(uu.getAvailableVersion()).append("<br>"); // NOI18N
desc = getDependencies(uu, collectDependencies);
} else {
text.append("<b>").append(getBundle("UnitDetails_Plugin_Version")).append("</b>").append(u.getDisplayVersion()).append("<br>"); // NOI18N
}
if (u.getAuthor() != null && u.getAuthor().length() > 0) {
text.append("<b>").append(getBundle("UnitDetails_Plugin_Author")).append("</b>").append(u.getAuthor()).append("<br>"); // NOI18N
}
if (u.getDisplayDate() != null && u.getDisplayDate().length() > 0) {
text.append("<b>").append(getBundle("UnitDetails_Plugin_Date")).append("</b>").append(u.getDisplayDate()).append("<br>"); // NOI18N
}
text.append("<b>").append(getBundle("UnitDetails_Plugin_Source")).append("</b>").append(u.getSource()).append("<br>"); // NOI18N
if (u.getHomepage() != null && u.getHomepage().length() > 0) {
text.append("<b>").append(getBundle("UnitDetails_Plugin_Homepage")).append("</b><a href=\"").append(u.getHomepage()).append("\">").append(u.getHomepage()).append("</a><br>"); // NOI18N
}
if (u.getNotification() != null && u.getNotification().length() > 0) {
text.append("<br><h3>").append(getBundle("UnitDetails_Plugin_Notification")).append("</h3>"); // NOI18N
text.append("<font color=\"red\">"); // NOI18N
text.append(u.getNotification());
text.append("</font><br>"); // NOI18N
}
if (u.getDescription() != null && u.getDescription().length() > 0) {
text.append("<br><h3>").append(getBundle("UnitDetails_Plugin_Description")).append("</h3>"); // NOI18N
String description = u.getDescription();
if(description.toLowerCase().startsWith("<html>")) {
text.append(description.substring(6));
} else {
text.append(description);
}
}
if (desc != null && desc.length() > 0) {
text.append("<br><br><h4>").append(getBundle("Unit_InternalUpdates_Title")).append("</h4>"); // NOI18N
text.append(desc);
}
}