当前位置: 首页>>代码示例>>Java>>正文


Java ImageUtilities.image2Icon方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ExcludeDependencyPanel.java

示例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();
            }
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:MavenSourcesImpl.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SearchScopeNodeSelection.java

示例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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:BreadCrumbComponent.java

示例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;

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BookmarkNodeRenderer.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:VisualizerNode.java

示例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();
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:ExtIconTest.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:SettingsTab.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:RunAnalysisPanel.java

示例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);
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:10,代码来源:AndroidNodes.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ExcludeDependencyPanel.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DashboardUtils.java

示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:CommandCompletionProvider.java


注:本文中的org.openide.util.ImageUtilities.image2Icon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。