Class Icons

  • Direct Known Subclasses:
    OverlayIcons

    public class Icons
    extends java.lang.Object

    Stores a set of different sized versions of the same icon.

    To get an icon from an image file you should use IconUtilities.getIcons(String), preferably with at least a 32 * 32 pixel image.

    Note: All dimensions are in abstract points not pixels. This means that the various getIcon methods may return a different sized icon in different environments. For example under Java 8 on Windows when using a scale factor of 200%, getIcon32() will return a 64x64 pixel image . See GuiUtilities.getScaleFactor()

    • Constructor Summary

      Constructors 
      Constructor Description
      Icons​(javax.swing.Icon icon)
      Creates Icons from a single sized Icon.
      Icons​(javax.swing.Icon... icons)
      Creates Icons from many sizes of icon.
      Icons​(javax.swing.Icon iconSmall, javax.swing.Icon iconLarge)
      Creates Icons from two sized Icons.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      Icons asGreyedOut​(double saturationAdjustment, float alpha)
      Creates a copy of this Icons with less (or more) saturation and/or a change in alpha.
      static javax.swing.ImageIcon createGreyedOutIcon​(javax.swing.Icon icon)  
      boolean equals​(java.lang.Object o)  
      javax.swing.Icon getIcon​(int size)
      Return a size * size point icon
      javax.swing.Icon getIcon​(int size, java.awt.Color overrideColor)
      Moves the colors in this Icons towards the given color.
      javax.swing.Icon getIcon16()
      Return a 16 * 16 point icon.
      javax.swing.Icon getIcon24()
      Return a 24 * 24 point icon.
      javax.swing.Icon getIcon32()
      Return a 32 * 32 point icon.
      java.lang.String getId()
      Used internally by Geneious for caching.
      javax.swing.Icon getOriginalIcon()
      Return the icon used to construct this Icons object if the single parameter constructor was used, or the largest icon if a multiple parameter constructor was used.
      javax.swing.Icon getOriginalIconForRetina()
      This method is intended for images that are rendered at double resolution, in order to display well on HiDPI displays.

      It returns the icon used to construct this Icons object if the single parameter constructor was used, or the larger icon if the two parameter constructor was used.

      If running on a device with a HiDPI display, the return is not scaled up like getOriginalIcon(), but is instead configured to render at double resolution (i.e.
      javax.swing.Icon getOriginalIconUnscaled()
      Deprecated.
      since API 4.201910 (Geneious 2019.1.0) use getOriginalIconForRetina() or getOriginalIcon() ()}instead.
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Icons

        public Icons​(javax.swing.Icon icon)
        Creates Icons from a single sized Icon. The Icon will be scaled to sizes 16 * 16 and 32 * 32 It is best to supply an Icon of 32 * 32 for image quality. It is not recommended to create Icons from a 16 * 16 Icon if 32 * 32 is to be used.
        Parameters:
        icon - of any size. Must not be null.
      • Icons

        public Icons​(javax.swing.Icon... icons)
        Creates Icons from many sizes of icon. The icon resources do not need to be in any particular size order, but the icons do need to be square. For non square icons, see Icons(javax.swing.Icon,javax.swing.Icon)
        Parameters:
        icons - A list of different sized renderings of the icon
        Since:
        API 4.201910 (Geneious 2019.1.0)
        See Also:
        IconUtilities.getIcons(String...)
      • Icons

        public Icons​(javax.swing.Icon iconSmall,
                     javax.swing.Icon iconLarge)
        Creates Icons from two sized Icons. The second is assumed to be the higher resolution. Both may be resized to make them 16 * 16 and 32 * 32. If one Icon is null it will be made by resizing the other. This constructor should be used for toolbar buttons.
        Parameters:
        iconSmall - preferably 16 * 16 pixels. May be null only if iconLarge is not null.
        iconLarge - preferably 24 * 24 pixels for actions and 32 * 32 for documents. May be null only if iconSmall is not null.
    • Method Detail

      • createGreyedOutIcon

        public static javax.swing.ImageIcon createGreyedOutIcon​(javax.swing.Icon icon)
        Parameters:
        icon - the icon to create a greyed out version of
        Returns:
        a greyed out version of this icon
        Since:
        API 4.202020 (Geneious 2020.2.0)
      • getId

        public java.lang.String getId()
        Used internally by Geneious for caching.
        Returns:
        A UUID string that is based on the pixel data of the icon images used to construct this Icons. Therefore identical Icons should have identical id's. Note that the id is dependent on the order of the images passed in to the constructor, so Icons created with images specified in different orders will have different id's
        Since:
        API 4.201910 (Geneious 2019.1.0)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • asGreyedOut

        public Icons asGreyedOut​(double saturationAdjustment,
                                 float alpha)
        Creates a copy of this Icons with less (or more) saturation and/or a change in alpha. Used for operations not matching the selection signature and summary documents. It is recommended to instead call IconUtilities.createGrayedOutIcons(Icons, double, float) to take advantage of its caching features
        Parameters:
        saturationAdjustment - amount 0 means 0 saturation (black and white), 1 gives no change, and > 1 increases saturation. Negative values are awesome.
        alpha - 0 for transparent, 1 for no change (opaque), in between for translucent.
        Returns:
        the grayed out copy of this Icons
        Since:
        API 4.201910 (Geneious 2019.1.0)
      • getIcon16

        public javax.swing.Icon getIcon16()
        Return a 16 * 16 point icon. Appropriate for use in JTree, JTable rows and small JButtons.
      • getIcon24

        public javax.swing.Icon getIcon24()
        Return a 24 * 24 point icon. Appropriate for use in large toolbar buttons.
      • getIcon32

        public javax.swing.Icon getIcon32()
        Return a 32 * 32 point icon. Appropriate for use in large table rows.
      • getOriginalIconUnscaled

        @Deprecated
        public javax.swing.Icon getOriginalIconUnscaled()
        Deprecated.
        since API 4.201910 (Geneious 2019.1.0) use getOriginalIconForRetina() or getOriginalIcon() ()}instead.
        Return the icon used to construct this Icons object if the single parameter constructor was used, or the larger icon if the two parameter constructor was used.
        Since:
        API 4.916 (Geneious 9.1.6)
      • getOriginalIcon

        public javax.swing.Icon getOriginalIcon()
        Return the icon used to construct this Icons object if the single parameter constructor was used, or the largest icon if a multiple parameter constructor was used. The return is scaled up to display at the original size on HiDPI if necessary.
      • getOriginalIconForRetina

        public javax.swing.Icon getOriginalIconForRetina()
        This method is intended for images that are rendered at double resolution, in order to display well on HiDPI displays.

        It returns the icon used to construct this Icons object if the single parameter constructor was used, or the larger icon if the two parameter constructor was used.

        If running on a device with a HiDPI display, the return is not scaled up like getOriginalIcon(), but is instead configured to render at double resolution (i.e. half the width and height of the source image).

        If running on a normal DPI display, a half size icon is returned if it was provided in the constructor to this Icons, or if none exists then the HiDPI image is scaled down to half its original width and height.
        Returns:
        the Icon as described above
        Since:
        API 4.201910 (Geneious 2019.1.0)
      • getIcon

        public javax.swing.Icon getIcon​(int size,
                                        java.awt.Color overrideColor)
        Moves the colors in this Icons towards the given color. For example, this is how folder images are assigned the color the user chooses in the service tree.
        Parameters:
        size - The size of icon to generate
        overrideColor - The color used to color the icon
        Returns:
        The colored icon at the specified size
        Since:
        API 4.201910 (Geneious 2019.1.0)
      • getIcon

        public javax.swing.Icon getIcon​(int size)
        Return a size * size point icon
        Parameters:
        size - size in pixels of the icon to get