Đang chuẩn bị liên kết để tải về tài liệu:
J2ME in a Nutshell phần 9

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Nếu tên lớp là mơ hồ, tên gói là luôn luôn được sử dụng. Nếu lớp là một phần của gói java.lang hoặc là một lớp rất thường được sử dụng, tên gói được bỏ qua. Nếu các lớp được gọi là một phần của gói hiện tại (và có một mục nhanh chóng tham chiếu | J2ME in a Nutshell Font style Selects a style of the given font face. Legal values are STYLE_PLAIN STYLE_ITALIC STYLE_BOLD and STYLE_UNDERLINE. STYLE_ITALIC and STYLE_BOLD may be used together to request a bold italic font. STYLE_UNDERLINE may be combined with any of the other styles. Font size The relative size of the font chosen from SIZE_SMALL SIZE_MEDIUM and SIZELARGE. Since the capabilities of MIDP devices vary widely the application is only able to select a font based on this narrow set of logical attributes. The getFont method returns the font from the set available to it that most closely matches the arguments supplied to it. Some devices may be able to closely match a wide range of requested fonts while others might only be able to accurately represent a very small number. In order to minimize memory usage the same Font instance will be returned by this method whenever the arguments supplied to it resolve to the same device font. This is possible because Font objects are immutable. The Font object has methods that allow certain font attributes to be retrieved including isBold isItalic and isUnderlined which return the component parts of the font style. Note that the values returned by these methods represent the font actually selected and may not match those supplied to getFont . The selected font size and face can also be retrieved using the getSize and getFace methods. Several methods of the Font class perform functions that are supplied by the FontMetrics and LineMetrics classes in J2SE. The charWidth charsWidth stringWidth and substringWidth methods measure the horizontal size of a string or set of characters when rendered by the Font object on which they are called. The getHeight method returns the height of a standard line in the font including interline spacing while getBaselinePosition returns the distance from the top of the font to its baseline both of these being measured in pixels. These methods can be used when manually placing text using the