org.openide.util.ImageUtilities Java Examples
The following examples show how to use
org.openide.util.ImageUtilities.
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: AntProjectNode.java From netbeans with Apache License 2.0 | 6 votes |
private Image getBasicIcon() { AntProjectCookie.ParseStatus cookie = getCookie(AntProjectCookie.ParseStatus.class); if (cookie.getFile() == null && cookie.getFileObject() == null) { // Script has been invalidated perhaps? Don't continue, we would // just get an NPE from the getParseException. return ImageUtilities.loadImage("org/apache/tools/ant/module/resources/AntIconError.gif"); // NOI18N } if (!cookie.isParsed()) { // Assume for now it is not erroneous. return ImageUtilities.loadImage("org/apache/tools/ant/module/resources/AntIcon.gif"); // NOI18N } Throwable exc = cookie.getParseException(); if (exc != null) { return ImageUtilities.loadImage("org/apache/tools/ant/module/resources/AntIconError.gif"); // NOI18N } else { return ImageUtilities.loadImage("org/apache/tools/ant/module/resources/AntIcon.gif"); // NOI18N } }
Example #2
Source File: IdeSnapshot.java From visualvm with GNU General Public License v2.0 | 6 votes |
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (DECORABLE_SETNAME_METHOD.equals(methodName)) { recInfo.setName((String) args[0]); } if (DECORABLE_SETDISPLAYNAME_METHOD.equals(methodName)) { recInfo.setDisplayName((String) args[0]); } if (DECORABLE_SETSHORTDESCRIPTOR_METHOD.equals(methodName)) { recInfo.setToolTip((String) args[0]); } if (DECORABLE_SETICONBASE_METHOD.equals(methodName)) { String iconBase = (String) args[0]; recInfo.setIcon(ImageUtilities.loadImageIcon(iconBase, true)); } return null; }
Example #3
Source File: InstallationManager.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "NotifyMultipleInstallations.title=Multiple MySQL installations found", "NotifyMultipleInstallations.text=Select the installation to use" }) private static void notifyAboutMultipleInstallations() { NotificationDisplayer.getDefault().notify( Bundle.NotifyMultipleInstallations_title(), ImageUtilities.loadImageIcon(ICON_BASE, false), Bundle.NotifyMultipleInstallations_text(), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SelectInstallationPanel.showSelectInstallationDialog(); } }, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING); }
Example #4
Source File: ServiceTabProcessorTest.java From netbeans with Apache License 2.0 | 6 votes |
@Test public void testNodesGeneratedCorrectly() throws Exception { Collection<? extends Node> arr = Lookups.forPath("UI/Runtime").lookupAll(Node.class); assertEquals("One node is there: " + arr, 1, arr.size()); Node n = arr.iterator().next(); assertEquals("my1", n.getName()); assertEquals("disp1", n.getDisplayName()); assertEquals("By default short description delegates to displayName", n.getDisplayName(), n.getShortDescription()); Image img1 = ImageUtilities.loadImage("org/netbeans/core/ide/TestIcon1.png"); Image img2 = ImageUtilities.loadImage("org/netbeans/core/ide/TestIcon2.png"); assertSame("icon1 is in use", img1, n.getIcon(BeanInfo.ICON_COLOR_16x16)); Node[] subNodes = n.getChildren().getNodes(true); assertEquals("Two subnodes", 2, subNodes.length); // now everything is initialized assertEquals("my2", n.getName()); assertEquals("disp2", n.getDisplayName()); assertEquals("short2", n.getShortDescription()); assertSame("icon2 is in use", img2, n.getIcon(BeanInfo.ICON_COLOR_16x16)); }
Example #5
Source File: PackageDisplayUtils.java From netbeans with Apache License 2.0 | 6 votes |
public static Image getIcon( @NonNull final FileObject pkg, final boolean empty, @NonNull Callable<Accessibility> accessibilityProvider) { if ( empty ) { return ImageUtilities.loadImage(PACKAGE_EMPTY); } else { Accessibility a; try { a = pkg.isValid() ? accessibilityProvider.call() : Accessibility.UNKNOWN; } catch (Exception e) { a = Accessibility.UNKNOWN; } switch (a) { case EXPORTED: return ImageUtilities.loadImage(PACKAGE_PUBLIC); case PRIVATE: return ImageUtilities.loadImage(PACKAGE_PRIVATE); case UNKNOWN: return ImageUtilities.loadImage(PACKAGE); default: throw new IllegalStateException(String.valueOf(a)); } } }
Example #6
Source File: PlatformNode.java From netbeans with Apache License 2.0 | 6 votes |
private List<SourceGroup> getKeys() { JavaPlatform platform = ((PlatformNode)this.getNode()).pp.getPlatform(); if (platform == null) { return Collections.emptyList(); } //Todo: Should listen on returned classpath, but now the bootstrap libraries are read only FileObject[] roots = platform.getBootstrapLibraries().getRoots(); List<SourceGroup> result = new ArrayList<SourceGroup>(roots.length); for (int i=0; i<roots.length; i++) { FileObject file; Icon icon; if ("jar".equals(roots[i].toURL().getProtocol())) { //NOI18N file = FileUtil.getArchiveFile(roots[i]); icon = ImageUtilities.loadImageIcon(ARCHIVE_ICON, false); } else { file = roots[i]; icon = null; } if (file.isValid()) { result.add(new LibrariesSourceGroup(roots[i], file.getNameExt(), icon, icon)); } } return result; }
Example #7
Source File: ElementIcons.java From netbeans with Apache License 2.0 | 6 votes |
/** * Returns an icon for the given {@link ModuleElement.DirectiveKind}. * @param kind the {@link ModuleElement.DirectiveKind} to return an icon for. * @return the icon * @since 1.45 */ public static Icon getModuleDirectiveIcon(@NonNull final ModuleElement.DirectiveKind kind) { Parameters.notNull("kind", kind); //NOI18N switch (kind) { case EXPORTS: return ImageUtilities.loadImageIcon(EXPORTS_ICON, true); case REQUIRES: return ImageUtilities.loadImageIcon(REQUIRES_ICON, true); case USES: return ImageUtilities.loadImageIcon(USES_ICON, true); case PROVIDES: return ImageUtilities.loadImageIcon(PROVIDES_ICON, true); case OPENS: return ImageUtilities.loadImageIcon(OPENS_ICON, true); default: throw new IllegalArgumentException(kind.toString()); } }
Example #8
Source File: ClientSideProjectLogicalView.java From netbeans with Apache License 2.0 | 6 votes |
private Image annotateImage(Image image) { Image icon = image; boolean badged = false; // platform providers for (PlatformProvider provider : project.getPlatformProviders()) { BadgeIcon badgeIcon = provider.getBadgeIcon(); if (badgeIcon != null) { icon = ImageUtilities.addToolTipToImage(icon, String.format(ICON_TOOLTIP, badgeIcon.getUrl(), provider.getDisplayName())); if (!badged) { icon = ImageUtilities.mergeImages(icon, badgeIcon.getImage(), 0, 0); badged = true; } } else { icon = ImageUtilities.addToolTipToImage(icon, String.format(ICON_TOOLTIP, PLACEHOLDER_BADGE_URL, provider.getDisplayName())); } } // project type, only if no platform if (!badged) { Image projectBadge = ImageUtilities.loadImage(project.isJsLibrary() ? JS_LIBRARY_BADGE_ICON : HTML5_BADGE_ICON); icon = ImageUtilities.mergeImages(icon, projectBadge, 0, 0); } return icon; }
Example #9
Source File: VariablesViewButtons.java From netbeans with Apache License 2.0 | 6 votes |
private static JToggleButton createToggleButton (final String id, String iconPath, String tooltip) { Icon icon = ImageUtilities.loadImageIcon(iconPath, false); boolean isSelected = isButtonSelected(id); final JToggleButton toggleButton = new JToggleButton(icon, isSelected); // ensure small size, just for the icon Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8); toggleButton.setPreferredSize(size); toggleButton.setMargin(new Insets(1, 1, 1, 1)); if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N // We do not want an ugly border with the exception of Mac, where it paints the toggle state! toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton))); } toggleButton.setToolTipText(tooltip); toggleButton.setFocusable(false); return toggleButton; }
Example #10
Source File: LibrariesNode.java From netbeans with Apache License 2.0 | 6 votes |
private static SourceGroup createFileSourceGroup (File file, Collection<? super URL> rootsList) { Icon icon; Icon openedIcon; String displayName; final URL url = FileUtil.urlForArchiveOrDir(file); if (url == null) { return null; } else if ("jar".equals(url.getProtocol())) { //NOI18N icon = openedIcon = ImageUtilities.loadImageIcon(ARCHIVE_ICON, false); displayName = file.getName(); } else { icon = getFolderIcon (false); openedIcon = getFolderIcon (true); displayName = file.getAbsolutePath(); } rootsList.add (url); FileObject root = URLMapper.findFileObject (url); if (root != null) { return new LibrariesSourceGroup (root,displayName,icon,openedIcon); } return null; }
Example #11
Source File: AmazonJ2EEInstanceNode.java From netbeans with Apache License 2.0 | 6 votes |
private Image badgeIcon(Image origImg) { Image badge = null; switch (aij.getState()) { case UPDATING: case LAUNCHING: case TERMINATING: badge = ImageUtilities.loadImage(WAITING_ICON); break; case READY: badge = ImageUtilities.loadImage(RUNNING_ICON); break; case TERMINATED: badge = ImageUtilities.loadImage(TERMINATED_ICON); break; } return badge != null ? ImageUtilities.mergeImages(origImg, badge, 15, 8) : origImg; }
Example #12
Source File: DBColumnDrop.java From netbeans with Apache License 2.0 | 5 votes |
/** * Returns <code>JTextField</code> palette item. * * @param dtde corresponding drop target drag event. * @return <code>JTextField</code> palette item. */ @Override public PaletteItem getPaletteItem(DropTargetDragEvent dtde) { PaletteItem pItem; if (!assistantInitialized) { initAssistant(); } if (!J2EEUtils.hasPrimaryKey(column.getDatabaseConnection(), column.getTableName())) { FormEditor.getAssistantModel(model).setContext("tableWithoutPK"); // NOI18N return null; } if (FormJavaSource.isInDefaultPackage(model)) { // 97982: default package FormEditor.getAssistantModel(model).setContext("columnDefaultPackage"); // NOI18N return null; } setBindingOnly(dtde.getDropAction() == DnDConstants.ACTION_MOVE); if (isBindingOnly()) { FormEditor.getAssistantModel(model).setContext("columnDropBinding", "columnDropComponent"); // NOI18N pItem = new PaletteItem(new ClassSource("javax.persistence.EntityManager", // NOI18N new ClassSourceResolver.LibraryEntry(LibraryManager.getDefault().getLibrary("eclipselink"))), // NOI18N null); pItem.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/form/j2ee/resources/binding.gif", false).getImage()); // NOI18N } else { pItem = new PaletteItem(new ClassSource("javax.swing.JTextField"), null); // NOI18N } return pItem; }
Example #13
Source File: JAXBBindingSupportFileNode.java From netbeans with Apache License 2.0 | 5 votes |
public Image getOpenedIcon(int type) { if (this.nodeDelegate != null){ return this.nodeDelegate.getOpenedIcon(type); } return ImageUtilities.loadImage( "org/netbeans/modules/xml/jaxb/resources/XML_file.png" );//NOI18N }
Example #14
Source File: UiUtils.java From netbeans with Apache License 2.0 | 5 votes |
/** * Returns default folder icon as {@link Image}. Never returns {@code null}. * @param opened whether closed or opened icon should be returned * @return default folder icon */ public static Image getTreeFolderIcon(boolean opened) { Image base = (Image) UIManager.get(opened ? OPENED_ICON_KEY_UIMANAGER_NB : ICON_KEY_UIMANAGER_NB); // #70263 if (base == null) { Icon baseIcon = UIManager.getIcon(opened ? OPENED_ICON_KEY_UIMANAGER : ICON_KEY_UIMANAGER); // #70263 if (baseIcon != null) { base = ImageUtilities.icon2Image(baseIcon); } else { // fallback to our owns base = ImageUtilities.loadImage(opened ? OPENED_ICON_PATH : ICON_PATH, false); } } return base; }
Example #15
Source File: VisualizerNodeTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testNodeToolTip() { AbstractNode n = new AbstractNode(Children.LEAF) { @Override public Image getIcon(int type) { return ImageUtilities.assignToolTipToImage(super.getIcon(type), "test"); } }; VisualizerNode vn = (VisualizerNode) Visualizer.findVisualizer(n); assertEquals(vn.getShortDescription(), "<html><br>test</html>"); }
Example #16
Source File: DelegatingScopeProvider.java From netbeans with Apache License 2.0 | 5 votes |
private DelegatingScopeProvider(Map<?, ?> map) { this.map = map; String path = (String) map.get("iconBase"); //NOI18N icon = path != null && !path.equals("") ? ImageUtilities.loadImageIcon(path, false) : null; id = (String) map.get("id"); //NOI18N displayName = (String) map.get("displayName"); //NOI18N position = (Integer) map.get("position"); //NOI18N }
Example #17
Source File: SunResourceDataLoaderBeanInfo.java From netbeans with Apache License 2.0 | 5 votes |
public Image getIcon(int type) { if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { return ImageUtilities.loadImage("org/netbeans/modules/j2ee/sun/share/resources/sun-cluster_16_pad.gif", true); //NOI18N } else { return ImageUtilities.loadImage("org/netbeans/modules/j2ee/sun/share/resources/sun-cluster_16_pad32.gif", true); //NOI18N } }
Example #18
Source File: SyncPanel.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages("SyncPanel.diffButton.toolTip=Review differences between remote and local file") private void initDiffButton() { diffButton.setText(null); diffButton.setIcon(ImageUtilities.loadImageIcon(DIFF_ICON_PATH, false)); diffButton.setToolTipText(Bundle.SyncPanel_diffButton_toolTip()); diffButton.addActionListener(new DiffActionListener()); }
Example #19
Source File: XMLDataLoaderBeanInfo.java From netbeans with Apache License 2.0 | 5 votes |
/** @param type Desired type of the icon * @return returns the xml loader's icon */ public Image getIcon (int type) { if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || (type == java.beans.BeanInfo.ICON_MONO_16x16)) { return ImageUtilities.loadImage (ICON_DIR_BASE + "xmlObject.gif"); // NOI18N } else { return ImageUtilities.loadImage (ICON_DIR_BASE + "xmlObject32.gif"); // NOI18N } }
Example #20
Source File: ItemRenderer.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void stateChanged(@NonNull final ChangeEvent event) { final JViewport jv = (JViewport)event.getSource(); jlName.setText( "Sample" ); // NOI18N jlName.setIcon(ImageUtilities.loadImageIcon(SAMPLE_ITEM_ICON, false)); jList.setFixedCellHeight(jlName.getPreferredSize().height); jList.setFixedCellWidth(jv.getExtentSize().width); }
Example #21
Source File: PalettePanel.java From netbeans with Apache License 2.0 | 5 votes |
private void prepareSearchPanel() { if( searchpanel == null ) { searchpanel = new SearchPanel(); JLabel lbl = new JLabel(NbBundle.getMessage(PalettePanel.class, "LBL_QUICKSEARCH")); //NOI18N searchpanel.setLayout(new GridBagLayout()); searchpanel.add(lbl, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0)); searchpanel.add(searchTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0)); searchpanel.add(new JLabel(), new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0)); lbl.setLabelFor(searchTextField); searchTextField.setColumns(10); searchTextField.setMaximumSize(searchTextField.getPreferredSize()); searchTextField.putClientProperty("JTextField.variant", "search"); //NOI18N lbl.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); JButton btnCancel = new JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/palette/resources/cancel.png", true)); btnCancel.setBorder(BorderFactory.createEmptyBorder()); btnCancel.setBorderPainted(false); btnCancel.setOpaque(false); btnCancel.setContentAreaFilled(false); searchpanel.add(btnCancel, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0)); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeSearchField(); } }); } }
Example #22
Source File: MainProjectScanningScope.java From netbeans with Apache License 2.0 | 5 votes |
/** * @return New instance of MainProjectScanningScope */ public static MainProjectScanningScope create() { return new MainProjectScanningScope( NbBundle.getBundle( MainProjectScanningScope.class ).getString( "LBL_MainProjectScope" ), //NOI18N NbBundle.getBundle( MainProjectScanningScope.class ).getString( "HINT_MainProjectScope" ), //NOI18N ImageUtilities.loadImage( "org/netbeans/modules/tasklist/projectint/main_project_scope.png" ) //NOI18N ); }
Example #23
Source File: DashboardUtils.java From netbeans with Apache License 2.0 | 5 votes |
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); }
Example #24
Source File: PlatformNode.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private List<SourceGroup> getKeys() { AndroidClassPath cpProvider = ((PlatformNode) getNode()).project.getLookup().lookup(AndroidClassPath.class); if (cpProvider == null) { return Collections.emptyList(); } //Todo: Should listen on returned classpath, but now the bootstrap libraries are read only FileObject[] roots = cpProvider.getClassPath(ClassPath.BOOT).getRoots(); List<SourceGroup> result = new ArrayList<>(roots.length); for (FileObject root : roots) { if (AndroidClassPathProvider.VIRTUALJAVA8ROOT_DIR.getPath().equals(root.getPath())) { continue; } FileObject file; Icon icon; Icon openedIcon; if ("jar".equals(root.toURL().getProtocol())) { //NOI18N file = FileUtil.getArchiveFile(root); icon = openedIcon = new ImageIcon(ImageUtilities.loadImage(ARCHIVE_ICON)); } else { file = root; icon = null; openedIcon = null; } if (file.isValid()) { result.add(new LibrariesSourceGroup(root, file.getNameExt(), icon, openedIcon)); } } return result; }
Example #25
Source File: SiteDocsNode.java From netbeans with Apache License 2.0 | 5 votes |
@Override public java.awt.Image getIcon(int param) { java.awt.Image retValue = super.getIcon(param); if (isTopLevelNode) { retValue = ImageUtilities.mergeImages(retValue, ImageUtilities.loadImage(PSITE_BADGE), //NOI18N 8, 8); } return retValue; }
Example #26
Source File: AbstractNode.java From netbeans with Apache License 2.0 | 5 votes |
Image getDefaultIcon() { Image i = ImageUtilities.loadImage(DEFAULT_ICON, true); if (i == null) { throw new MissingResourceException("No default icon", "", DEFAULT_ICON); // NOI18N } return i; }
Example #27
Source File: MobileDeviceNode.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private Image annotateUsbWifi(Image icon) { if (device.hasEthernet()) { icon = ImageUtilities.mergeImages(icon, IconProvider.IMG_WIFI_BADGE, 12, 0); } if (device.hasUSB()) { icon = ImageUtilities.mergeImages(icon, IconProvider.IMG_USB_BADGE, 12, 8); } return icon; }
Example #28
Source File: DrawPolylineToolAction.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public DrawPolylineToolAction(Lookup lookup) { super(lookup); putValue(NAME, Bundle.CTL_DrawPolylineToolActionText()); putValue(SHORT_DESCRIPTION, Bundle.CTL_DrawPolylineToolActionDescription()); putValue(SMALL_ICON, ImageUtilities.loadImageIcon("org/esa/snap/rcp/icons/DrawPolylineTool24.gif", false)); Interactor interactor = new InsertPolylineFigureInteractor(); interactor.addListener(new InsertFigureInteractorInterceptor()); setInteractor(interactor); }
Example #29
Source File: ZoomManager.java From netbeans with Apache License 2.0 | 5 votes |
/** * Creates a new instance of ZoomDefaultAction. * * @param manager the zoom manager. */ public ZoomDefaultAction(ZoomManager manager) { this.manager = manager; String path = NbBundle.getMessage(ZoomDefaultAction.class, "IMG_ZoomDefaultAction"); Image img = ImageUtilities.loadImage(path); if (img != null) { putValue(Action.SMALL_ICON, new ImageIcon(img)); } String desc = NbBundle.getMessage(ZoomDefaultAction.class, "LBL_ZoomDefaultAction"); putValue(Action.NAME, desc); // for accessibility putValue(Action.SHORT_DESCRIPTION, desc); }
Example #30
Source File: JavadocTopComponent.java From netbeans with Apache License 2.0 | 5 votes |
private JavadocTopComponent() { initComponents(); setName(NbBundle.getMessage(JavadocTopComponent.class, "CTL_JavadocTopComponent")); setToolTipText(NbBundle.getMessage(JavadocTopComponent.class, "HINT_JavadocTopComponent")); setIcon(ImageUtilities.loadImage(ICON_PATH, true)); documentationPane = new DocumentationScrollPane( false ); add( documentationPane, BorderLayout.CENTER ); }