📄 color.html
字号:
values in the range (0 - 255).
<P></P>
<DT><B>Parameters:</B>
<DD><CODE>r</CODE> - the red component
<DD><CODE>g</CODE> - the green component
<DD><CODE>b</CODE> - the blue component
<DD><CODE>a</CODE> - the alpha component
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRed()"><CODE>getRed()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getGreen()"><CODE>getGreen()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getBlue()"><CODE>getBlue()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getAlpha()"><CODE>getAlpha()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL>
<HR>
<A name=Color(int)><!-- --></A>
<H3>Color</H3><PRE>public <B>Color</B>(int rgb)</PRE>
<DL>
<DD>Creates an opaque sRGB color with the specified combined RGB value
consisting of the red component in bits 16-23, the green component in bits
8-15, and the blue component in bits 0-7. The actual color used in rendering
depends on finding the best match given the color space available for a
particular output device. Alpha is defaulted to 255.
<P></P>
<DT><B>Parameters:</B>
<DD><CODE>rgb</CODE> - the combined RGB components
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/image/ColorModel.html#getRGBdefault()"><CODE>ColorModel.getRGBdefault()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRed()"><CODE>getRed()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getGreen()"><CODE>getGreen()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getBlue()"><CODE>getBlue()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL>
<HR>
<A name="Color(int, boolean)"><!-- --></A>
<H3>Color</H3><PRE>public <B>Color</B>(int rgba,
boolean hasalpha)</PRE>
<DL>
<DD>Creates an sRGB color with the specified combined RGBA value consisting of
the alpha component in bits 24-31, the red component in bits 16-23, the green
component in bits 8-15, and the blue component in bits 0-7. If the
<CODE>hasalpha</CODE> argument is <CODE>false</CODE>, alpha is defaulted to
255.
<P></P>
<DT><B>Parameters:</B>
<DD><CODE>rgba</CODE> - the combined RGBA components
<DD><CODE>hasalpha</CODE> - <CODE>true</CODE> if the alpha bits are valid;
<CODE>false</CODE> otherwise
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/image/ColorModel.html#getRGBdefault()"><CODE>ColorModel.getRGBdefault()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRed()"><CODE>getRed()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getGreen()"><CODE>getGreen()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getBlue()"><CODE>getBlue()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getAlpha()"><CODE>getAlpha()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL>
<HR>
<A name="Color(float, float, float)"><!-- --></A>
<H3>Color</H3><PRE>public <B>Color</B>(float r,
float g,
float b)</PRE>
<DL>
<DD>Creates an opaque sRGB color with the specified red, green, and blue
values in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The actual color
used in rendering depends on finding the best match given the color space
available for a particular output device.
<P></P>
<DT><B>Parameters:</B>
<DD><CODE>r</CODE> - the red component
<DD><CODE>g</CODE> - the green component
<DD><CODE>b</CODE> - the blue component
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRed()"><CODE>getRed()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getGreen()"><CODE>getGreen()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getBlue()"><CODE>getBlue()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL>
<HR>
<A name="Color(float, float, float, float)"><!-- --></A>
<H3>Color</H3><PRE>public <B>Color</B>(float r,
float g,
float b,
float a)</PRE>
<DL>
<DD>Creates an sRGB color with the specified red, green, blue, and alpha
values in the range (0.0 - 1.0). The actual color used in rendering depends on
finding the best match given the color space available for a particular output
device.
<P></P>
<DT><B>Parameters:</B>
<DD><CODE>r</CODE> - the red component
<DD><CODE>g</CODE> - the green component
<DD><CODE>b</CODE> - the blue component
<DD><CODE>a</CODE> - the alpha component
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRed()"><CODE>getRed()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getGreen()"><CODE>getGreen()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getBlue()"><CODE>getBlue()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getAlpha()"><CODE>getAlpha()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL>
<HR>
<A name="Color(java.awt.color.ColorSpace, float[], float)"><!-- --></A>
<H3>Color</H3><PRE>public <B>Color</B>(<A title="class in java.awt.color" href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/color/ColorSpace.html">ColorSpace</A> cspace,
float[] components,
float alpha)</PRE>
<DL>
<DD>Creates a color in the specified <CODE>ColorSpace</CODE> with the color
components specified in the <CODE>float</CODE> array and the specified alpha.
The number of components is determined by the type of the
<CODE>ColorSpace</CODE>. For example, RGB requires 3 components, but CMYK
requires 4 components.
<P></P>
<DT><B>Parameters:</B>
<DD><CODE>cspace</CODE> - the <CODE>ColorSpace</CODE> to be used to interpret
the components
<DD><CODE>components</CODE> - an arbitrary number of color components that is
compatible with the
<DD><CODE>alpha</CODE> - alpha value
<DT><B>Throws:</B>
<DD><CODE><A title="class in java.lang"
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE>
- if any of the values in the <CODE>components</CODE> array or
<CODE>alpha</CODE> is outside of the range 0.0 to 1.0
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getComponents(float[])"><CODE>getComponents(float[])</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getColorComponents(float[])"><CODE>getColorComponents(float[])</CODE></A></DD></DL><!-- ============ METHOD DETAIL ========== --><A
name=method_detail><!-- --></A>
<TABLE cellSpacing=0 cellPadding=3 width="100%" summary="" border=1>
<TBODY>
<TR class=TableHeadingColor bgColor=#ccccff>
<TD><FONT size=+2><B>Method Detail</B></FONT></TD></TR></TBODY></TABLE><A
name=getRed()><!-- --></A>
<H3>getRed</H3><PRE>public int <B>getRed</B>()</PRE>
<DL>
<DD>Returns the red component in the range 0-255 in the default sRGB space.
<P></P>
<DD>
<DL></DL>
<DD>
<DL>
<DT><B>Returns:</B>
<DD>the red component.
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL></DD></DL>
<HR>
<A name=getGreen()><!-- --></A>
<H3>getGreen</H3><PRE>public int <B>getGreen</B>()</PRE>
<DL>
<DD>Returns the green component in the range 0-255 in the default sRGB space.
<P></P>
<DD>
<DL></DL>
<DD>
<DL>
<DT><B>Returns:</B>
<DD>the green component.
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL></DD></DL>
<HR>
<A name=getBlue()><!-- --></A>
<H3>getBlue</H3><PRE>public int <B>getBlue</B>()</PRE>
<DL>
<DD>Returns the blue component in the range 0-255 in the default sRGB space.
<P></P>
<DD>
<DL></DL>
<DD>
<DL>
<DT><B>Returns:</B>
<DD>the blue component.
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL></DD></DL>
<HR>
<A name=getAlpha()><!-- --></A>
<H3>getAlpha</H3><PRE>public int <B>getAlpha</B>()</PRE>
<DL>
<DD>Returns the alpha component in the range 0-255.
<P></P>
<DD>
<DL></DL>
<DD>
<DL>
<DT><B>Returns:</B>
<DD>the alpha component.
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRGB()"><CODE>getRGB()</CODE></A></DD></DL></DD></DL>
<HR>
<A name=getRGB()><!-- --></A>
<H3>getRGB</H3><PRE>public int <B>getRGB</B>()</PRE>
<DL>
<DD>Returns the RGB value representing the color in the default sRGB <A
title="class in java.awt.image"
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/image/ColorModel.html"><CODE>ColorModel</CODE></A>.
(Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).
<P></P>
<DD>
<DL></DL>
<DD>
<DL>
<DT><B>Returns:</B>
<DD>the RGB value of the color in the default sRGB <CODE>ColorModel</CODE>.
<DT><B>Since:</B>
<DD>JDK1.0
<DT><B>See Also:</B>
<DD><A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/image/ColorModel.html#getRGBdefault()"><CODE>ColorModel.getRGBdefault()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getRed()"><CODE>getRed()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getGreen()"><CODE>getGreen()</CODE></A>,
<A
href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html#getBlue()"><CODE>getBlue()</CODE></A></DD></DL></DD></DL>
<HR>
<A name=brighter()><!-- --></A>
<H3>brighter</H3><PRE>public <A title="class in java.awt" href="file:///D:/Tools/j2sdk-1_4_2-doc/api/java/awt/Color.html">Color</A>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -