本文整理匯總了Java中org.openide.util.ImageUtilities.image2Icon方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageUtilities.image2Icon方法的具體用法?Java ImageUtilities.image2Icon怎麽用?Java ImageUtilities.image2Icon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.util.ImageUtilities
的用法示例。
在下文中一共展示了ImageUtilities.image2Icon方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createReferenceModel
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private TreeNode createReferenceModel(Set<DependencyNode> nds, CheckNode trans) {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(null, true);
ChangeListener list = new Listener();
List<CheckNode> s = new ArrayList<CheckNode>();
Icon icn = ImageUtilities.image2Icon(ImageUtilities.loadImage(IconResources.DEPENDENCY_ICON, true)); //NOI18N
change2Trans.put(list, trans);
change2Refs.put(list, s);
for (DependencyNode nd : nds) {
String label = nd.getArtifact().getGroupId() + ":" + nd.getArtifact().getArtifactId();
CheckNode child = new CheckNode(nd, label, icn);
child.setSelected(isSingle);
child.addChangeListener(list);
s.add(child);
root.add(child);
}
return root;
}
示例2: OtherGroup
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Messages("SG_Root_not_defined=<Root not defined>")
OtherGroup(NbMavenProjectImpl p, FileObject rootFold, String nm, String displayNm, boolean test) {
project = p;
rootFolder = rootFold;
rootFile = FileUtil.toFile(rootFolder);
resource = checkResource(rootFold,
test ? project.getOriginalMavenProject().getTestResources() :
project.getOriginalMavenProject().getResources());
if (resource != null) {
Image badge = ImageUtilities.loadImage(OTHERS_BADGE, true); //NOI18N
// ImageUtilities.addToolTipToImage(badge, "Resource root as defined in POM.");
icon = ImageUtilities.image2Icon(ImageUtilities.mergeImages(NodeUtils.getTreeFolderIcon(false), badge, 8, 8));
openedIcon = ImageUtilities.image2Icon(ImageUtilities.mergeImages(NodeUtils.getTreeFolderIcon(true), badge, 8, 8));
name = FileUtilities.relativizeFile(FileUtil.toFile(project.getProjectDirectory()), FileUtilities.convertStringToFile(resource.getDirectory()));
displayName = name;
} else {
icon = ImageUtilities.image2Icon(NodeUtils.getTreeFolderIcon(false));
openedIcon = ImageUtilities.image2Icon(NodeUtils.getTreeFolderIcon(true));
name = nm;
displayName = displayNm != null ? displayNm : SG_Root_not_defined();
}
}
示例3: getIcon
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
public Icon getIcon() {
Node[] nodes = getNodes();
if (nodes.length > 1) {
return MULTI_SELECTION_ICON;
} else if (nodes.length == 1 && nodes[0] != null) {
Node n = nodes[0];
Image image = n.getIcon(BeanInfo.ICON_COLOR_16x16);
if (image != null) {
return ImageUtilities.image2Icon(image);
} else {
return null;
}
} else {
return null;
}
}
示例4: configureForNode
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private void configureForNode(Node node) {
renderer.reset();
Image nodeIcon = node.getIcon(BeanInfo.ICON_COLOR_16x16);
Icon icon = nodeIcon != null && nodeIcon != BreadcrumbsController.NO_ICON ? ImageUtilities.image2Icon(nodeIcon) : null;
int width = icon != null ? icon.getIconWidth() : 0;
if (width > 0) {
renderer.setIcon(icon);
renderer.setIconTextGap(ICON_TEXT_SEPARATOR);
} else {
renderer.setIcon(null);
renderer.setIconTextGap(0);
}
String html = node.getHtmlDisplayName();
if (html != null) {
renderer.setHtml(true);
renderer.setText(html);
} else {
renderer.setHtml(false);
renderer.setText(node.getDisplayName());
}
renderer.setFont(getFont());
}
示例5: getTableCellRendererComponent
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Icon icon = null;
BookmarksTableModel model = (BookmarksTableModel) table.getModel();
BookmarkNode bNode = model.getEntry(row);
BookmarkInfo bookmark = bNode.getBookmarkInfo();
Node fNode = bNode.getParentNode();
if (fNode != null) {
if (!isSelected) {
String text = fNode.getHtmlDisplayName();
if (text != null) {
text = bookmark.getDescription(text, forHistoryPopup, forHistoryPopup, true);
setText("<html>" + text + "</html>");
} // else leave original text set by "super"
}
Image image = fNode.getIcon(BeanInfo.ICON_COLOR_16x16);
if (image != null) {
icon = ImageUtilities.image2Icon(image);
}
}
setIcon(icon);
return this;
}
示例6: createZoomInButton
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private JButton createZoomInButton() {
JButton inButton = new JButton(ImageUtilities.image2Icon(ImageUtilities.loadImage("org/netbeans/modules/debugger/jpda/visual/resources/zoomIn.gif")));
inButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomIn"));
inButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomInA11yDescr"));
inButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
canvas.zoomIn();
}
});
inButton.setAlignmentX(CENTER_ALIGNMENT);
return inButton;
}
示例7: createZoomOutButton
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private JButton createZoomOutButton() {
JButton outButton = new JButton(ImageUtilities.image2Icon(ImageUtilities.loadImage("org/netbeans/modules/debugger/jpda/visual/resources/zoomOut.gif")));
outButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomOut"));
outButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOutA11yDescr"));
outButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
canvas.zoomOut();
}
});
outButton.setAlignmentX(CENTER_ALIGNMENT);
return outButton;
}
示例8: getIcon
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
Icon getIcon(boolean opened, boolean large) {
int newCacheType = getCacheType(opened, large);
if (cachedIconType != newCacheType) {
int iconType = large ? BeanInfo.ICON_COLOR_32x32 : BeanInfo.ICON_COLOR_16x16;
Image image;
try {
image = opened ? node.getOpenedIcon(iconType) : node.getIcon(iconType);
// bugfix #28515, check if getIcon contract isn't broken
if (image == null) {
String method = opened ? "getOpenedIcon" : "getIcon"; // NOI18N
LOG.warning(
"Node \"" + node.getName() + "\" [" + node.getClass().getName() + "] cannot return null from " +
method + "(). See Node." + method + " contract."
); // NOI18N
}
} catch (RuntimeException x) {
LOG.log(Level.INFO, null, x);
image = null;
}
if (image == null) {
icon = getDefaultIcon();
} else {
icon = ImageUtilities.image2Icon(image);
}
}
cachedIconType = newCacheType;
return icon;
}
示例9: testByteConversions
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
public void testByteConversions() {
ExtIcon ext = new ExtIcon();
URL res = getClass().getClassLoader().getResource("org/netbeans/modules/project/ui/module.gif");
assertNotNull(res);
//#138000
Image img = ImageUtilities.loadImage("org/netbeans/modules/project/ui/module.gif");
img = ImageUtilities.addToolTipToImage(img, "XXX");
Icon icon = ImageUtilities.image2Icon(img);
ext.setIcon(icon);
try {
byte[] bytes1 = ext.getBytes();
ExtIcon ext2 = new ExtIcon(bytes1);
byte[] bytes2 = ext2.getBytes();
ExtIcon ext3 = new ExtIcon(bytes2);
byte[] bytes3 = ext3.getBytes();
assertEquals(bytes1.length, bytes2.length);
assertEquals(bytes3.length, bytes3.length);
for (int i = 0; i < bytes1.length; i++) {
assertEquals("Non equals at position " + i,bytes1[i], bytes2[i]);
assertEquals("Non equals at position " + i,bytes1[i], bytes3[i]);
}
}
catch (IOException ex) {
Exceptions.printStackTrace(ex);
fail();
}
}
示例10: getTableCellRendererComponent
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel renderComponent = (JLabel) super.getTableCellRendererComponent (table, value, isSelected, hasFocus, row, column);
if (value instanceof UpdateUnitProvider) {
UpdateUnitProvider u = (UpdateUnitProvider) value;
Image img = u.getSourceIcon();
final Icon icon = ImageUtilities.image2Icon(img);
renderComponent.setIcon(icon);
renderComponent.setText (u.getDisplayName());
renderComponent.setHorizontalAlignment(SwingConstants.LEFT);
}
Component retval = renderComponent;
return retval;
}
示例11: getIcon
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
public Icon getIcon() {
try {
DataObject d = DataObject.find(file);
Node n = d.getNodeDelegate();
return ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16));
} catch (DataObjectNotFoundException ex) {
LOG.log(Level.FINE, null, ex);
return null;
}
}
示例12: createLibrarySourceGroup
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
public static SourceGroup createLibrarySourceGroup(String name, FileObject cpRoot) {
Icon openedIcon = cpRoot != null
? ImageUtilities.loadImageIcon(ARCHIVE_ICON, true)
: ImageUtilities.image2Icon(UiUtils.getTreeFolderIcon(true));
Icon closedIcon = cpRoot != null
? ImageUtilities.loadImageIcon(ARCHIVE_ICON, true)
: ImageUtilities.image2Icon(UiUtils.getTreeFolderIcon(false));
return new LibrariesSourceGroup(cpRoot, name, closedIcon, openedIcon);
}
示例13: createTransitiveDependenciesList
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
private TreeNode createTransitiveDependenciesList() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(null, true);
Set<Artifact> artifacts = project.getArtifacts();
Icon icn = ImageUtilities.image2Icon(ImageUtilities.loadImage(IconResources.TRANSITIVE_DEPENDENCY_ICON, true)); //NOI18N
for (Artifact a : artifacts) {
if (a.getDependencyTrail().size() > 2) {
String label = a.getGroupId() + ":" + a.getArtifactId();
root.add(new CheckNode(a, label, icn));
}
}
return root;
}
示例14: getTaskIcon
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
public static Icon getTaskIcon(IssueImpl issue) {
Image priorityIcon = issue.getPriorityIcon();
Image scheduleIcon = getScheduleIcon(issue);
if (scheduleIcon != null) {
return ImageUtilities.image2Icon(ImageUtilities.mergeImages(priorityIcon, scheduleIcon, 0, 0));
}
return ImageUtilities.image2Icon(priorityIcon);
}
示例15: getIcon
import org.openide.util.ImageUtilities; //導入方法依賴的package包/類
@Override
protected ImageIcon getIcon() {
if (insertText.endsWith("/")) { // NOI18N
return ImageUtilities.loadImageIcon(ICON_FOLDER, false);
} else if (fileResource != null) {
return ImageUtilities.loadImageIcon(fileResource, true);
} else if (icon != null) {
return icon;
} else {
Path p = basePath.resolve(insertText);
if (p != null) {
FileObject f = FileUtil.toFileObject(p.toFile());
if (f != null) {
Node n;
try {
DataObject d = DataObject.find(f);
n = d.getNodeDelegate();
} catch (DataObjectNotFoundException ex) {
n = f.getLookup().lookup(Node.class);
}
if (n != null) {
return (ImageIcon)ImageUtilities.image2Icon(n.getIcon(BeanInfo.ICON_COLOR_16x16));
}
}
}
return icon = ImageUtilities.loadImageIcon(ICON_FILE, false);
}
}