Use the font in cell phone programming with j2m2.

Source: Internet
Author: User

In the mobile programming of j2-based mobile phones, we can use the Font class to achieve better performance in the low-level user interface. How can we use the Font class?
First, due to restrictions on mobile phone devices, the Font types supported by mobile phones are very limited. Therefore, you can only use the default Font supported by mobile phones to construct Font-type objects. The following method is used to create a Font Class Object: getFont (int face, int style, int size); for example: Font font = Font. getFont (Font. FACE_SYSTEM, Font. STYLE_BOLD, Font. SIZE_MEDIUM); no matter which parameter, only the values set by the system can be used. The specific sizes of these values may vary on different mobile phones. The following describes in detail the values of the three parameters: the face parameter indicates the font appearance and its values: l FACE_MONOSPACE -- equal width font l FACE_PROPORTIONAL -- balanced font l FACE_SYSTEM -- the system font style parameter indicates the font style. The value can be: l STYLE_BOLD -- bold l STYLE_ITALIC -- italic l STYLE_PLAIN -- Common l italic -- underline l STYLE_BOLD | STYLE_ITALIC -- bold italic l STYLE_UNDERLINED | STYLE_BOLD -- bold with underline l Italic STYLE_UNDERLINED | STYLE_ITALIC | STYLE_BOLD -- the bold italic size parameter indicates the font size, value: l SIZE_SMALL -- small l SIZE_MEDIUM -- l SIZE_LARGE -- the value of the pass-through parameter in SIZE_MEDIUM can combine the font objects you need. Below are some common font operations: 1. obtain the default Font of the system: font Font = Font. getDefaultFont (); 2. in the panit method, if the Graphics parameter is named g, the method for obtaining the current Font is: font Font = g. getFont (); 3. in the panit method, if the Graphics parameter is named g, the current font is set to g. setFont (font); font indicates the font object you have constructed. 4. in MIDP2.0, you can set the font format of each line in List by: list. setFont (0, font); then the code above sets the first line in the list as a font.
The following describes the font size parameters of Nokia mobile phones:
Platform
Default font size (in pixels)
S40
12
S60
16
S80
21
Nokia7710
23

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.