Java Code Examples for org.openide.util.ImageUtilities#icon2Image()

The following examples show how to use org.openide.util.ImageUtilities#icon2Image() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackageRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Image computeIcon( boolean opened, int type ) {
    Image image;
    Icon icon = group.getIcon( opened );
    
    if ( icon == null ) {
        image = opened ? getDataFolderNodeDelegate().getOpenedIcon( type ) : 
                         getDataFolderNodeDelegate().getIcon( type );
        image = ImageUtilities.mergeImages(image, ImageUtilities.loadImage(PACKAGE_BADGE), 7, 7);
    }
    else {
        image = ImageUtilities.icon2Image(icon);
    }
    
    return image;        
}
 
Example 2
Source File: FileTreeView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Image getFolderIcon (File file) {
    FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(file));
    Icon icon = null;
    if (fo != null) {
        try {
            ProjectManager.Result res = ProjectManager.getDefault().isProject2(fo);
            if (res != null) {
                icon = res.getIcon();
            }
        } catch (IllegalArgumentException ex) {
            Logger.getLogger(FileTreeView.class.getName()).log(Level.INFO, null, ex);
        }
    }
    return icon == null ? FileTreeView.getFolderIcon() : ImageUtilities.icon2Image(icon);
}
 
Example 3
Source File: BreadCrumbsTask.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int type) {
    if (item.getCustomIcon() != null) {
        return ImageUtilities.icon2Image(item.getCustomIcon());
    }
    Icon icon = Icons.getElementIcon(item.getKind(), item.getModifiers());
    if (icon != null) {
        return ImageUtilities.icon2Image(icon);
    } else {
        return super.getIcon(type);
    }
}
 
Example 4
Source File: ElementDescription.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Icon getIcon() {
    Image badge;

    if (overriddenFlag) {
        badge = ImageUtilities.loadImage("org/netbeans/modules/java/editor/resources/is-overridden-badge.png");
    } else {
        badge = ImageUtilities.loadImage("org/netbeans/modules/java/editor/resources/overrides-badge.png");
    }

    Image icon = ImageUtilities.icon2Image(ElementIcons.getElementIcon(imageKind, modifiers));

    return ImageUtilities.image2Icon(ImageUtilities.mergeImages(icon, badge, 16, 0));
}
 
Example 5
Source File: SnippetNodes.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int type) {
    if (nodeKind == null) {
        return super.getIcon(type);
    }
    
    return ImageUtilities.icon2Image(
            ElementIcons.getElementIcon(nodeKind, EnumSet.of(Modifier.PUBLIC, Modifier.STATIC))
    );
}
 
Example 6
Source File: WebBrowser.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Image getIconImage(boolean small) {
        Image im = factoryDesc.getIconImage(small);
        if (im == null) {
            ImageIcon icon = ImageUtilities.loadImageIcon( getIconFile(getBrowserFamily(), small), true );
            im = ImageUtilities.icon2Image( icon );
        }
        if (hasNetBeansIntegration() && factoryDesc.getBrowserFamily() != BrowserFamilyId.JAVAFX_WEBVIEW) {
//            im = ImageUtilities.mergeImages(
//                im,
//                ImageUtilities.loadImage("org/netbeans/modules/web/browser/ui/resources/nb-badge.png"),
//            12, 12);
        }
        return im;
    }
 
Example 7
Source File: TruffleObjectNode.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void flagLoopTo() {
    Image loopImage = ImageUtilities.icon2Image(getIcon());
    setIcon(new ImageIcon(ImageUtilities.mergeImages(loopImage, IMAGE_LOOP, 0, 0)));
    setIconTextGap(4);

    ((LabelRenderer)valueRenderers()[0]).setMargin(3, 1, 3, 0);
}
 
Example 8
Source File: LogicalViewProviders.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int type) {
    final Icon icon = info.getIcon();
    final Image img = icon == null ?
        super.getIcon(type) :
        ImageUtilities.icon2Image(icon);
    return !broken && compileOnSaveDisabled ?
        ImageUtilities.mergeImages(img, compileOnSaveDisabledBadge, 8, 0) :
        img;
}
 
Example 9
Source File: ProjectNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int type) {
    if (cachedIcon == null) {
        ProjectInformation info = getProjectInformation();
        if (info != null) {
            Icon icon = info.getIcon();
            cachedIcon = ImageUtilities.icon2Image(icon);
        }
        else {
            cachedIcon = ImageUtilities.loadImage(PROJECT_ICON);
        }
    }
    return cachedIcon;
}
 
Example 10
Source File: OthersRootChildren.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Image computeIcon( boolean opened, int type ) {
    if (group.getResource() != null) {
        Icon icon = group.getIcon( opened );
        Image img = ImageUtilities.icon2Image(icon);
        if (group.getResource().isFiltering()) {
            Image warn = ImageUtilities.loadImage(FILTERED_RESOURCE);
            img = ImageUtilities.mergeImages(img, warn , 0, 8);
        }
        return img;
    } else {
        return super.getIcon(type);
    }
}
 
Example 11
Source File: MavenProjectNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int param) {
    Icon icon = info.getIcon();
    if (icon == null) {
        LOGGER.log(Level.WARNING, "no icon in {0}", info);
        return super.getIcon(param);
    }
    return ImageUtilities.icon2Image(icon);
}
 
Example 12
Source File: ModulesNodeFactory.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int type) {
    if (result.getIcon() != null) {
        return ImageUtilities.icon2Image(result.getIcon());
    }
    return super.getIcon(type); //To change body of generated methods, choose Tools | Templates.
}
 
Example 13
Source File: TreeRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Copied from PackageRootNode with modifications. */
private Image computeIcon(boolean opened, int type) {
    Icon icon = g.getIcon(opened);
    if (icon == null) {
        Image image = opened ? super.getOpenedIcon(type) : super.getIcon(type);
        return ImageUtilities.mergeImages(image, ImageUtilities.loadImage(PackageRootNode.PACKAGE_BADGE), 7, 7);
    } else {
        return ImageUtilities.icon2Image(icon);
    }
}
 
Example 14
Source File: ElementNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Image getIcon(int type) {
    return description.kind == null ? super.getIcon(type) : ImageUtilities.icon2Image(ElementIcons.getElementIcon(description.kind, description.modifiers));
}
 
Example 15
Source File: GradleProjectNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Image getOpenedIcon(int param) {
    return ImageUtilities.icon2Image(info.getIcon());
}
 
Example 16
Source File: ElementNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Image getIcon(int type) {
    if (description.elementHandle == null)
        return super.getIcon(type);
    return ImageUtilities.icon2Image(ElementIcons.getElementIcon(description.elementHandle.getKind(), description.modifiers));
}
 
Example 17
Source File: GradleProjectNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Image getIcon(int param) {
    return ImageUtilities.icon2Image(info.getIcon());
}
 
Example 18
Source File: FolderNodeFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Image getIcon(int type) {
    return ImageUtilities.icon2Image(info.getIcon());
}
 
Example 19
Source File: AddDependencyUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Image getIcon(int arg0) {
    return ImageUtilities.icon2Image(pi.getIcon());
}
 
Example 20
Source File: Splash.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Loads a splash image from its source. For high-resolution rendering on HiDPI displays, the
 * returned image should be converted to a HiDPI-aware Icon instance via
 * {@link ImageUtilities#image2Icon} prior to painting.
 *
 *  @param about if true then about image is loaded, if false splash image is loaded
 */
public static Image loadContent(boolean about) {
    return ImageUtilities.icon2Image(loadContentIcon(about));
}