Font in Java

Source: Internet
Author: User

The font class is located in Java. AWT

The font type is determined by three attributes:

1) font name (family name)

The name can be divided into two categories:
Chinese fonts:,, and;
English Font: Arial, Times New Roman, etc;

TIPS:

There are two terms for English fonts: "equal width font" and "widening font". An equal width font indicates the width of each English letter. Otherwise, the width of M and L is different.

2) Size)

The same as the font name, the size can be measured in two ways: Number 5 and number 6, the smaller the number, the larger the number, and the pound value (this is a general unit in the printing industry ), for example, 11 or 12 lbs. The larger the value, the larger the word. HoweverJavaOnly the latter, that is, point ).

3) style)

JavaThere are four typesFont Style,FontClass static value.

Font.Plain(Normal)

Font.Bold(Bold)

Font.Italic(Italic)

Font.Bold+Font.Italic(Bold and italic)

That is to say, inJavaThe language does not support the underline style.

The font class constructor constructs a font object:

PublicFont(String familyname, int style, int size)

Then, call the setfont method of the object to set the font:

Public void setfont (Font Font)

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.