Class SWTUtil


  • public class SWTUtil
    extends java.lang.Object
    Utility methods for dealing with SWT objects
    • Constructor Summary

      Constructors 
      Constructor Description
      SWTUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.swt.graphics.FontData copy​(org.eclipse.swt.graphics.FontData fontData)
      Returns a defensive copy of the passed in FontData.
      static org.eclipse.swt.graphics.RGB copy​(org.eclipse.swt.graphics.RGB rgb)
      Returns a defensive copy of the passed in RGB.
      static org.eclipse.swt.graphics.RGB deriveRGB​(int rgb)
      Returns an RGB representing the color described by the argument.
      static boolean equal​(org.eclipse.swt.graphics.ImageData left, org.eclipse.swt.graphics.ImageData right)
      Returns whether the ImageData arguments are equivalent.
      static boolean equal​(org.eclipse.swt.graphics.PaletteData left, org.eclipse.swt.graphics.PaletteData right)
      Returns whether the PaletteData arguments are equivalent.
      private static int hashCode​(java.lang.Object[] array)  
      static int hashCode​(org.eclipse.swt.graphics.ImageData data)
      Returns a hash code for the ImageData
      static int hashCode​(org.eclipse.swt.graphics.PaletteData data)
      Returns a hash code for the PaletteData.
      • Methods inherited from class java.lang.Object

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

      • SWTUtil

        public SWTUtil()
    • Method Detail

      • copy

        public static org.eclipse.swt.graphics.FontData copy​(org.eclipse.swt.graphics.FontData fontData)
        Returns a defensive copy of the passed in FontData.
        Parameters:
        fontData - the FontData to copy. May be null.
        Returns:
        a copy of the passed in FontData, or null if the argument was null.
      • copy

        public static org.eclipse.swt.graphics.RGB copy​(org.eclipse.swt.graphics.RGB rgb)
        Returns a defensive copy of the passed in RGB.
        Parameters:
        rgb - the RGB to copy. May be null.
        Returns:
        a copy of the passed in RGB, or null if the argument was null.
      • deriveRGB

        public static org.eclipse.swt.graphics.RGB deriveRGB​(int rgb)
        Returns an RGB representing the color described by the argument.

        Sample colors:
        0xFFFFFF: white
        0x000000: black
        0xFF0000: red
        0x00FF00: green
        0x0000FF: blue

        Parameters:
        rgb - an integer containing the red, green and blue components in the 0xFF0000, 0x00FF00, and 0x0000FF positions, respectively.
        Returns:
        an RGB representing the color described by the argument.
      • equal

        public static boolean equal​(org.eclipse.swt.graphics.PaletteData left,
                                    org.eclipse.swt.graphics.PaletteData right)
        Returns whether the PaletteData arguments are equivalent.
        Parameters:
        left - the left PaletteData
        right - the right PaletteData
        Returns:
        whether the PaletteData arguments are equivalent.
      • hashCode

        public static int hashCode​(org.eclipse.swt.graphics.PaletteData data)
        Returns a hash code for the PaletteData.
        Parameters:
        data - the PaletteData
        Returns:
        a hash code for the PaletteData.
      • hashCode

        private static int hashCode​(java.lang.Object[] array)
      • equal

        public static boolean equal​(org.eclipse.swt.graphics.ImageData left,
                                    org.eclipse.swt.graphics.ImageData right)
        Returns whether the ImageData arguments are equivalent.
        Parameters:
        left - the left ImageData
        right - the right ImageData
        Returns:
        whether the ImageData arguments are equivalent.
      • hashCode

        public static int hashCode​(org.eclipse.swt.graphics.ImageData data)
        Returns a hash code for the ImageData
        Parameters:
        data - the ImageData
        Returns:
        a hash code for the ImageData