src/share/classes/java/awt/Color.java

Print this page
rev 10048 : 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
Reviewed-by:

*** 595,605 **** * <code>ColorModel</code>. * @see java.awt.image.ColorModel#getRGBdefault * @see #getRed * @see #getGreen * @see #getBlue ! * @since JDK1.0 */ public int getRGB() { return value; } --- 595,605 ---- * <code>ColorModel</code>. * @see java.awt.image.ColorModel#getRGBdefault * @see #getRed * @see #getGreen * @see #getBlue ! * @since 1.0 */ public int getRGB() { return value; }
*** 619,629 **** * because of rounding errors. * @return a new <code>Color</code> object that is * a brighter version of this <code>Color</code> * with the same {@code alpha} value. * @see java.awt.Color#darker ! * @since JDK1.0 */ public Color brighter() { int r = getRed(); int g = getGreen(); int b = getBlue(); --- 619,629 ---- * because of rounding errors. * @return a new <code>Color</code> object that is * a brighter version of this <code>Color</code> * with the same {@code alpha} value. * @see java.awt.Color#darker ! * @since 1.0 */ public Color brighter() { int r = getRed(); int g = getGreen(); int b = getBlue();
*** 662,672 **** * of rounding errors. * @return a new <code>Color</code> object that is * a darker version of this <code>Color</code> * with the same {@code alpha} value. * @see java.awt.Color#brighter ! * @since JDK1.0 */ public Color darker() { return new Color(Math.max((int)(getRed() *FACTOR), 0), Math.max((int)(getGreen()*FACTOR), 0), Math.max((int)(getBlue() *FACTOR), 0), --- 662,672 ---- * of rounding errors. * @return a new <code>Color</code> object that is * a darker version of this <code>Color</code> * with the same {@code alpha} value. * @see java.awt.Color#brighter ! * @since 1.0 */ public Color darker() { return new Color(Math.max((int)(getRed() *FACTOR), 0), Math.max((int)(getGreen()*FACTOR), 0), Math.max((int)(getBlue() *FACTOR), 0),
*** 674,684 **** } /** * Computes the hash code for this <code>Color</code>. * @return a hash code value for this object. ! * @since JDK1.0 */ public int hashCode() { return value; } --- 674,684 ---- } /** * Computes the hash code for this <code>Color</code>. * @return a hash code value for this object. ! * @since 1.0 */ public int hashCode() { return value; }
*** 691,701 **** * red, green, blue, and alpha values as this object. * @param obj the object to test for equality with this * <code>Color</code> * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. ! * @since JDK1.0 */ public boolean equals(Object obj) { return obj instanceof Color && ((Color)obj).getRGB() == this.getRGB(); } --- 691,701 ---- * red, green, blue, and alpha values as this object. * @param obj the object to test for equality with this * <code>Color</code> * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. ! * @since 1.0 */ public boolean equals(Object obj) { return obj instanceof Color && ((Color)obj).getRGB() == this.getRGB(); }
*** 721,731 **** * @return the new <code>Color</code> object. * @see java.lang.Integer#decode * @exception NumberFormatException if the specified string cannot * be interpreted as a decimal, * octal, or hexadecimal integer. ! * @since JDK1.1 */ public static Color decode(String nm) throws NumberFormatException { Integer intval = Integer.decode(nm); int i = intval.intValue(); return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF); --- 721,731 ---- * @return the new <code>Color</code> object. * @see java.lang.Integer#decode * @exception NumberFormatException if the specified string cannot * be interpreted as a decimal, * octal, or hexadecimal integer. ! * @since 1.1 */ public static Color decode(String nm) throws NumberFormatException { Integer intval = Integer.decode(nm); int i = intval.intValue(); return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);
*** 745,755 **** * @return the <code>Color</code> converted from the system * property. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.Integer#getInteger(java.lang.String) * @see java.awt.Color#Color(int) ! * @since JDK1.0 */ public static Color getColor(String nm) { return getColor(nm, null); } --- 745,755 ---- * @return the <code>Color</code> converted from the system * property. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.Integer#getInteger(java.lang.String) * @see java.awt.Color#Color(int) ! * @since 1.0 */ public static Color getColor(String nm) { return getColor(nm, null); }
*** 769,779 **** * @return the <code>Color</code> converted from the system * property, or the specified <code>Color</code>. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.Integer#getInteger(java.lang.String) * @see java.awt.Color#Color(int) ! * @since JDK1.0 */ public static Color getColor(String nm, Color v) { Integer intval = Integer.getInteger(nm); if (intval == null) { return v; --- 769,779 ---- * @return the <code>Color</code> converted from the system * property, or the specified <code>Color</code>. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.Integer#getInteger(java.lang.String) * @see java.awt.Color#Color(int) ! * @since 1.0 */ public static Color getColor(String nm, Color v) { Integer intval = Integer.getInteger(nm); if (intval == null) { return v;
*** 799,809 **** * property or the <code>Color</code> converted from * the specified integer. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.Integer#getInteger(java.lang.String) * @see java.awt.Color#Color(int) ! * @since JDK1.0 */ public static Color getColor(String nm, int v) { Integer intval = Integer.getInteger(nm); int i = (intval != null) ? intval.intValue() : v; return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, (i >> 0) & 0xFF); --- 799,809 ---- * property or the <code>Color</code> converted from * the specified integer. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.Integer#getInteger(java.lang.String) * @see java.awt.Color#Color(int) ! * @since 1.0 */ public static Color getColor(String nm, int v) { Integer intval = Integer.getInteger(nm); int i = (intval != null) ? intval.intValue() : v; return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, (i >> 0) & 0xFF);
*** 832,842 **** * @return the RGB value of the color with the indicated hue, * saturation, and brightness. * @see java.awt.Color#getRGB() * @see java.awt.Color#Color(int) * @see java.awt.image.ColorModel#getRGBdefault() ! * @since JDK1.0 */ public static int HSBtoRGB(float hue, float saturation, float brightness) { int r = 0, g = 0, b = 0; if (saturation == 0) { r = g = b = (int) (brightness * 255.0f + 0.5f); --- 832,842 ---- * @return the RGB value of the color with the indicated hue, * saturation, and brightness. * @see java.awt.Color#getRGB() * @see java.awt.Color#Color(int) * @see java.awt.image.ColorModel#getRGBdefault() ! * @since 1.0 */ public static int HSBtoRGB(float hue, float saturation, float brightness) { int r = 0, g = 0, b = 0; if (saturation == 0) { r = g = b = (int) (brightness * 255.0f + 0.5f);
*** 900,910 **** * and brightness (in that order), of the color with * the indicated red, green, and blue components. * @see java.awt.Color#getRGB() * @see java.awt.Color#Color(int) * @see java.awt.image.ColorModel#getRGBdefault() ! * @since JDK1.0 */ public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals) { float hue, saturation, brightness; if (hsbvals == null) { hsbvals = new float[3]; --- 900,910 ---- * and brightness (in that order), of the color with * the indicated red, green, and blue components. * @see java.awt.Color#getRGB() * @see java.awt.Color#Color(int) * @see java.awt.image.ColorModel#getRGBdefault() ! * @since 1.0 */ public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals) { float hue, saturation, brightness; if (hsbvals == null) { hsbvals = new float[3];
*** 955,965 **** * @param h the hue component * @param s the saturation of the color * @param b the brightness of the color * @return a <code>Color</code> object with the specified hue, * saturation, and brightness. ! * @since JDK1.0 */ public static Color getHSBColor(float h, float s, float b) { return new Color(HSBtoRGB(h, s, b)); } --- 955,965 ---- * @param h the hue component * @param s the saturation of the color * @param b the brightness of the color * @return a <code>Color</code> object with the specified hue, * saturation, and brightness. ! * @since 1.0 */ public static Color getHSBColor(float h, float s, float b) { return new Color(HSBtoRGB(h, s, b)); }