Package sc.fiji.snt.gui
Class IconFactory
java.lang.Object
sc.fiji.snt.gui.IconFactory
A factory for
FADerivedIcons presets.- Author:
- Tiago Ferreira
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IconaccentIcon(Color color, boolean squarify) static voidassignDoubleIcon(JMenuItem menuItem, IconFactory.GLYPH defaultIcon, IconFactory.GLYPH selectedIcon, IconFactory.GLYPH secondaryIcon) static voidassignDoubleLetterIcon(JMenuItem item, char letter1, char letter2, boolean solid) Assigns a two-letter icon (seedoubleLetterIcon(char, char, Color)) to a menu item, including its disabled state.static voidassignIcon(AbstractButton button, IconFactory.GLYPH glyph, Color color, float scalingFactor) static voidassignIcon(AbstractButton button, IconFactory.GLYPH glyph, Color defaultColor, Color disabledColor, float scalingFactor) static voidassignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph) static voidassignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph, float scalingFactor) static voidassignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph, Color color, float scalingFactor) static voidassignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph, Color defaultColor, Color selectedColor, float scalingFactor) static voidassignIcon(JMenuItem item, char symbol, boolean solid, Color color) static voidassignIcon(JMenuItem item, IconFactory.GLYPH defaultGlyph) static voidassignNotification(AbstractButton button, Color dotColor) Decorates a button's icon(s) with a notification dot in the upper right corner, wrapping whichever icons are already assigned (including selected/disabled states for aJToggleButton)static voidassignTabIcon(JTabbedPane tabbedPane, int tabIndex, IconFactory.GLYPH entry) static TitledBorderbottomBorder(char symbol, boolean solid) static IconbuttonIcon(char symbol, boolean solid) static IconbuttonIcon(char symbol, boolean solid, Color color) static IconbuttonIcon(IconFactory.GLYPH entry, float scalingFactor) static IconbuttonIcon(IconFactory.GLYPH entry, Color color, float scalingFactor) static Colorstatic intstatic Colorstatic Colorstatic IcondoubleIcon(IconFactory.GLYPH entry1, IconFactory.GLYPH entry2, float scalingFactor, Color color) static IcondoubleLetterIcon(char letter1, char letter2, boolean solid, float scalingFactor, Color color) Creates a two-letter icon (e.g., "CT"), analogous todoubleIcon(GLYPH, GLYPH, float, Color)but built from two plain characters rather thanIconFactory.GLYPHentries.static IcondoubleLetterIcon(char letter1, char letter2, Color color) Convenience method fordoubleLetterIcon(char, char, boolean, float, Color)using a scaling factor of 1f and solid font weight.static IcondropdownMenuIcon(IconFactory.GLYPH entry, float scalingFactor, Color color) static IconfixedWidthIcon(Icon icon, int refWidth) Wraps an icon in a fixed-width icon, centering it within a common reference.static IconfixedWidthIcon(Icon icon, Icon refIcon) Wraps an icon in a fixed-width icon, centering it within a common reference.static Iconget(IconFactory.GLYPH entry, float size, Color color) Creates a new icon from a Font Awesome glyph.static ImageIcongetAsImage(IconFactory.GLYPH entry, float size, Color color) Creates a new image icon from a Font Awesome glyph.static IconlistIcon(JList<?> list, IconFactory.GLYPH entry) static IconlistIcon(JList<?> list, IconFactory.GLYPH entry, Color color) static IconlistIcon(JList<?> list, IconFactory.GLYPH entry1, IconFactory.GLYPH entry2) Two-glyph analog oflistIcon(JList, GLYPH): compositesentry1andentry2side by side (seedoubleIcon(GLYPH, GLYPH, float, Color)), scaled to match single-glyphlistIconicons in the same list, rather thandoubleIcon's own default-size-relative scaling (meant for toolbar buttons, not list rows).static IconlistIcon(JList<?> list, IconFactory.GLYPH entry1, IconFactory.GLYPH entry2, Color color) static IconmenuIcon(char symbol, boolean solid) static Iconstatic IconmenuIcon(IconFactory.GLYPH entry) static IconmenuIcon(IconFactory.GLYPH entry, Color color) static IconmenuIcon(IconFactory.GLYPH entry, Color from, Color to) Creates a menu icon rendered as a horizontal gradient between two colors.static Iconstatic Iconstatic IconnodeIconMulticolor(boolean isLeaf, boolean isExpanded) static IconnotificationIcon(Icon icon, Color dotColor, Color ringColor) Overlays a small notification dot on an icon's upper right corner within the icon's own bounds (the icon's reported size is unchanged).static Colorstatic Color
-
Constructor Details
-
IconFactory
public IconFactory()
-
-
Method Details
-
disabledColor
-
get
Creates a new icon from a Font Awesome glyph.- Parameters:
entry- the glyph defining the icon's Unicode IDsize- the icon's sizecolor- the icon's color- Returns:
- the icon
-
getAsImage
Creates a new image icon from a Font Awesome glyph.- Parameters:
entry- the glyph defining the icon's Unicode IDsize- the icon's sizecolor- the icon's color- Returns:
- the icon
-
buttonIcon
-
buttonIcon
-
buttonIcon
-
buttonIcon
-
listIcon
-
listIcon
-
listIcon
Two-glyph analog oflistIcon(JList, GLYPH): compositesentry1andentry2side by side (seedoubleIcon(GLYPH, GLYPH, float, Color)), scaled to match single-glyphlistIconicons in the same list, rather thandoubleIcon's own default-size-relative scaling (meant for toolbar buttons, not list rows). -
listIcon
public static Icon listIcon(JList<?> list, IconFactory.GLYPH entry1, IconFactory.GLYPH entry2, Color color) -
assignTabIcon
-
bottomBorder
-
doubleIcon
public static Icon doubleIcon(IconFactory.GLYPH entry1, IconFactory.GLYPH entry2, float scalingFactor, Color color) -
doubleLetterIcon
public static Icon doubleLetterIcon(char letter1, char letter2, boolean solid, float scalingFactor, Color color) Creates a two-letter icon (e.g., "CT"), analogous todoubleIcon(GLYPH, GLYPH, float, Color)but built from two plain characters rather thanIconFactory.GLYPHentries. Useful forJMenuItemicons that combine single-letter tags, such as the "C"(hannel)/"T"(frame) Path Manager tags.- Parameters:
letter1- the first (left) letter, e.g., 'C'letter2- the second (right) letter, e.g., 'T'solid- whether the letters are rendered using the solid (vs. regular) weight fontscalingFactor- the icon's scaling factor relative to the default sizecolor- the icon's color- Returns:
- the icon
-
doubleLetterIcon
Convenience method fordoubleLetterIcon(char, char, boolean, float, Color)using a scaling factor of 1f and solid font weight.- Parameters:
letter1- the first (left) letter, e.g., 'C'letter2- the second (right) letter, e.g., 'T'color- the icon's color- Returns:
- the icon
-
assignDoubleLetterIcon
public static void assignDoubleLetterIcon(JMenuItem item, char letter1, char letter2, boolean solid) Assigns a two-letter icon (seedoubleLetterIcon(char, char, Color)) to a menu item, including its disabled state.- Parameters:
item- the menu item to be assigned an iconletter1- the first (left) letter, e.g., 'C'letter2- the second (right) letter, e.g., 'T'solid- whether the letters are rendered using the solid (vs. regular) weight font
-
notificationIcon
Overlays a small notification dot on an icon's upper right corner within the icon's own bounds (the icon's reported size is unchanged).- Parameters:
icon- the source icondotColor- the dot's fill colorringColor- contrast ring color around the dot, or null for no ring- See Also:
-
dropdownMenuIcon
-
assignIcon
public static void assignIcon(AbstractButton button, IconFactory.GLYPH glyph, Color color, float scalingFactor) -
assignIcon
public static void assignIcon(AbstractButton button, IconFactory.GLYPH glyph, Color defaultColor, Color disabledColor, float scalingFactor) -
assignIcon
public static void assignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph, float scalingFactor) -
assignIcon
public static void assignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph, Color color, float scalingFactor) -
assignIcon
public static void assignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph, Color defaultColor, Color selectedColor, float scalingFactor) -
assignIcon
public static void assignIcon(AbstractButton button, IconFactory.GLYPH defaultGlyph, IconFactory.GLYPH selectedGlyph) -
assignIcon
-
assignIcon
-
assignDoubleIcon
public static void assignDoubleIcon(JMenuItem menuItem, IconFactory.GLYPH defaultIcon, IconFactory.GLYPH selectedIcon, IconFactory.GLYPH secondaryIcon) -
assignNotification
Decorates a button's icon(s) with a notification dot in the upper right corner, wrapping whichever icons are already assigned (including selected/disabled states for aJToggleButton)- Parameters:
button- the button to decoratedotColor- the dot's fill color (e.g., Color.RED)- See Also:
-
defaultColor
-
secondaryColor
-
selectedColor
-
disabledSelectedColor
- Returns:
- a faded version of
selectedColor(), for a disabled icon/button that should still read as "selected"/"active".
-
nodeIcon
-
nodeIcon
-
nodeIconMulticolor
-
accentIcon
-
fixedWidthIcon
Wraps an icon in a fixed-width icon, centering it within a common reference.- Parameters:
icon- the icon to be matched to referencerefIcon- reference icon, setting the target width- Returns:
- the centered fixed-width icon
-
fixedWidthIcon
Wraps an icon in a fixed-width icon, centering it within a common reference.- Parameters:
icon- the icon to be matched to referencerefWidth- the target width- Returns:
- the centered fixed-width icon
-
defaultSize
public static int defaultSize()
-