Icon icon = group.getIcon("cut"); cutAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("copy"); copyAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("paste"); pasteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("delete"); deleteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("undo"); undoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("redo"); redoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("selectall"); selectAllAction.putValue(Action.SMALL_ICON, icon); iconGroup = group;
/** * Returns the large icon from this icon group with the specified name. * If this icon group does not have large icons, <code>null</code> is * returned. * * @param name The name of the icon. For example, if you want the icon * specified in <code>new.gif</code>, this value should be * <code>new</code>. * @return The icon, or <code>null</code> if it could not be found or * loaded. * @see #getLargeIcon */ public Icon getLargeIcon(String name) { return getIconImpl(path + largeIconSubDir + "/" + name + "." + extension); }
/** * Returns whether two icon groups are equal. * * @param o2 The object to check against. * @return Whether <code>o2</code> represents the same icons as this icon * group. */ @Override public boolean equals(Object o2) { if (o2 instanceof IconGroup) { IconGroup ig2 = (IconGroup)o2; if (ig2.getName().equals(getName()) && separateLargeIcons==ig2.hasSeparateLargeIcons()) { if (separateLargeIcons) { if (!largeIconSubDir.equals(ig2.largeIconSubDir)) { return false; } } return path.equals(ig2.path); } // If we got here, separateLargeIcons values weren't equal. } return false; }
@Override public int hashCode() { return getName().hashCode(); }
@Override public int hashCode() { return getName().hashCode(); }
/** * Returns whether two icon groups are equal. * * @param o2 The object to check against. * @return Whether <code>o2</code> represents the same icons as this icon * group. */ @Override public boolean equals(Object o2) { if (o2 instanceof IconGroup) { IconGroup ig2 = (IconGroup)o2; if (ig2.getName().equals(getName()) && separateLargeIcons==ig2.hasSeparateLargeIcons()) { if (separateLargeIcons) { if (!largeIconSubDir.equals(ig2.largeIconSubDir)) { return false; } } return path.equals(ig2.path); } // If we got here, separateLargeIcons values weren't equal. } return false; }
/** * Returns an icon that represents the file type specified. * * @param rstaSyntax The syntax value, from {@code SyntaxConstants}. * @return The icon, or {@code null} if a fallback icon should be used. */ public Icon getFileTypeIcon(String rstaSyntax) { int slash = rstaSyntax.indexOf('/'); if (slash > -1) { String fileType = rstaSyntax.substring(slash + 1).toLowerCase(); String path = "fileTypes/" + fileType + '.' + extension; Icon icon = getIconImpl(path); if (icon == null) { icon = getIconImpl("fileTypes/default." + extension); } return icon; } return null; }
/** * Overridden since we also override {@link #equals(Object)}, to honor * the invariant that equal objects must have equal hashcodes. This also * keeps FindBugs happy. */ public int hashCode() { return getName().hashCode(); }
Icon icon = group.getIcon("cut"); cutAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("copy"); copyAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("paste"); pasteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("delete"); deleteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("undo"); undoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("redo"); redoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("selectall"); selectAllAction.putValue(Action.SMALL_ICON, icon); iconGroup = group;
/** * Returns whether two icon groups are equal. * * @param o2 The object to check against. * @return Whether <code>o2</code> represents the same icons as this icon * group. */ public boolean equals(Object o2) { if (o2!=null && o2 instanceof IconGroup) { IconGroup ig2 = (IconGroup)o2; if (ig2.getName().equals(getName()) && separateLargeIcons==ig2.hasSeparateLargeIcons()) { if (separateLargeIcons) { if (!largeIconSubDir.equals(ig2.largeIconSubDir)) return false; } return path.equals(ig2.path); } // If we got here, separateLargeIcons values weren't equal. } return false; }
/** * Returns the icon from this icon group with the specified name. * * @param name The name of the icon. For example, if you want the icon * specified in <code>new.gif</code>, this value should be * <code>new</code>. * @return The icon, or <code>null</code> if it could not be found or * loaded. * @see #getLargeIcon */ public Icon getIcon(String name) { Icon icon = getIconImpl(path + name + "." + extension); // JDK 6.0 b74 returns icons with width/height==-1 in certain error // cases (new ImageIcon(url) where url is not resolved?). We'll // just return null in this case as Swing AbstractButtons throw // exceptions when expected to paint an icon with width or height // is less than 1. if (icon!=null && (icon.getIconWidth()<1 || icon.getIconHeight()<1)) { icon = null; } return icon; }
/** * Overridden since we also override {@link #equals(Object)}, to honor * the invariant that equal objects must have equal hashcodes. This also * keeps FindBugs happy. */ public int hashCode() { return getName().hashCode(); }
Icon icon = group.getIcon("cut"); cutAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("copy"); copyAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("paste"); pasteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("delete"); deleteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("undo"); undoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("redo"); redoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("selectall"); selectAllAction.putValue(Action.SMALL_ICON, icon); iconGroup = group;
/** * Returns whether two icon groups are equal. * * @param o2 The object to check against. * @return Whether <code>o2</code> represents the same icons as this icon * group. */ public boolean equals(Object o2) { if (o2!=null && o2 instanceof IconGroup) { IconGroup ig2 = (IconGroup)o2; if (ig2.getName().equals(getName()) && separateLargeIcons==ig2.hasSeparateLargeIcons()) { if (separateLargeIcons) { if (!largeIconSubDir.equals(ig2.largeIconSubDir)) return false; } return path.equals(ig2.path); } // If we got here, separateLargeIcons values weren't equal. } return false; }
/** * Returns the large icon from this icon group with the specified name. * If this icon group does not have large icons, <code>null</code> is * returned. * * @param name The name of the icon. For example, if you want the icon * specified in <code>new.gif</code>, this value should be * <code>new</code>. * @return The icon, or <code>null</code> if it could not be found or * loaded. * @see #getLargeIcon */ public Icon getLargeIcon(String name) { return getIconImpl(path + largeIconSubDir + "/" + name + "." + extension); }
Icon icon = group.getIcon("cut"); cutAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("copy"); copyAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("paste"); pasteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("delete"); deleteAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("undo"); undoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("redo"); redoAction.putValue(Action.SMALL_ICON, icon); icon = group.getIcon("selectall"); selectAllAction.putValue(Action.SMALL_ICON, icon); iconGroup = group;
/** * Returns the large icon from this icon group with the specified name. * If this icon group does not have large icons, <code>null</code> is * returned. * * @param name The name of the icon. For example, if you want the icon * specified in <code>new.gif</code>, this value should be * <code>new</code>. * @return The icon, or <code>null</code> if it could not be found or * loaded. * @see #getLargeIcon */ public Icon getLargeIcon(String name) { return getIconImpl(path + largeIconSubDir + "/" + name + "." + extension); }
/** * Returns the large icon from this icon group with the specified name. * If this icon group does not have large icons, <code>null</code> is * returned. * * @param name The name of the icon. For example, if you want the icon * specified in <code>new.gif</code>, this value should be * <code>new</code>. * @return The icon, or <code>null</code> if it could not be found or * loaded. * @see #getLargeIcon */ public Icon getLargeIcon(String name) { return getIconImpl(path + largeIconSubDir + "/" + name + "." + extension); }
/** * Returns an icon that represents the file type specified. * * @param rstaSyntax The syntax value, from {@code SyntaxConstants}. * @return The icon, or {@code null} if a fallback icon should be used. */ public Icon getFileTypeIcon(String rstaSyntax) { int slash = rstaSyntax.indexOf('/'); if (slash > -1) { String fileType = rstaSyntax.substring(slash + 1).toLowerCase(); String path = "fileTypes/" + fileType + '.' + extension; Icon icon = getIconImpl(path); if (icon == null) { icon = getIconImpl("fileTypes/default." + extension); } return icon; } return null; }
/** * Returns the icon from this icon group with the specified name. * * @param name The name of the icon. For example, if you want the icon * specified in <code>new.gif</code>, this value should be * <code>new</code>. * @return The icon, or <code>null</code> if it could not be found or * loaded. * @see #getLargeIcon */ public Icon getIcon(String name) { Icon icon = getIconImpl(path + name + "." + extension); // JDK 6.0 b74 returns icons with width/height==-1 in certain error // cases (new ImageIcon(url) where url is not resolved?). We'll // just return null in this case as Swing AbstractButtons throw // exceptions when expected to paint an icon with width or height // is less than 1. if (icon!=null && (icon.getIconWidth()<1 || icon.getIconHeight()<1)) { icon = null; } return icon; }