Use the color in the development of the mobile phone program

Source: Internet
Author: User

Color is often used for painting during the development process of the mobile phone program for enhancing the performance of the program. The following describes how to use color.
Due to the relatively simple technology, the special color class is not implemented, but the RGB concept is used to represent the color. Here we will briefly introduce the concept of RGB. colors are composed of three primary colors: Red, Green, and Blue, therefore, the combination of these three colors can be used to represent a specific color. Each value of R, G, and B is between 0 and. When expressing colors, you can use three numbers or a hexadecimal format, such as 0X00RRGGBB. The following is a common expression of colors:
Red :( 255, 0, 0) or 0x00FF0000
Green: (0,255, 0) or 0x0000FF00
White: (255,255,255) or 0x00FFFFFF
Other colors can also be combined through the above method.
After learning about the color expression, we will introduce how to use the color in the j2s program. The methods involved are in the Graphics class, including the following:
1. getColor ():
Obtain the current color. The returned value is a number in 0x00RRGGBB format. For example:
Int color = g. getColor ();
Where g is a Graphics type object.
2. setColor (int RGB ):
Set the color used. For example:
G. setColor (0x00ff0000 );
3. setColor (int red, int green, int blue)
It works the same way as the preceding method, for example:
G. setColor (255, 0, 0 );
After the color used by Graphics is set, you can draw the specified color.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.