Font类常量和相关的绘图方法 Method or constant Descrption public final static int PLAIN A constant representing a plain font style // Font class public final static int BOLD A constant representing a bold font style Font class public final static int ITALIC A constant representing an italic font style // Font class public Font( String name, int Creates a Font object with the specified font, style and size style, int size public int getstyleo Returns an integer value indicating the current font style / Font class public int getsizeo Returns an integer value indicating the current font size // Font class public string getName( Returns the current font name as a string / Font class public string getFamily o Returns the font's family name as a string // Font class Fig 11.8 Font methods, constants and font-related Graphics methods(Part 1 of 2) 2021/2/24 北京理工大学计算机系(共48页) 16
2021/2/24 北京理工大学计算机系(共48页) 16 Font类常量和相关的绘图方法 Method or constant Description public final static int PLAIN // Font class A constant representing a plain font style. public final static int BOLD // Font class A constant representing a bold font style. public final static int ITALIC // Font class A constant representing an italic font style. public Font( String name, int style, int size ) Creates a Font object with the specified font, style and size. public int getStyle() // Font class Returns an integer value indicating the current font style. public int getSize() // Font class Returns an integer value indicating the current font size. public String getName() // Font class Returns the current font name as a string. public String getFamily() // Font class Returns the font’s family name as a string. Fig. 11.8 Font methods, c onstants and font-related Graphics methods (Part 1 of 2)
Font类常量和相关的绘图方法 Method or constant Description public boolean isPlain( Tests a font for a plain font style. Returns true if the / Font class font is plain public boolean isBoldo Tests a font for a bold font style. Returns true if the / Font class font is bold public boolean isItalic( Tests a font for an italic font style. Returns true if the Font class font is italic public Font getFont( Returns a Font object reference representing the current // Graphics cl font public void setFont( Font f) Sets the current font to the font, style and size specified // Graphics class by the Font object reference f Fig.11.8 Font methods, constants and font-related Graphics methods(Part 2 of 2) 2021/2/24 北京理工大学计算机系(共48页) 17
2021/2/24 北京理工大学计算机系(共48页) 17 Method or constant Description public boolean isPlain() // Font class Tests a font for a plain font style. Returns true if the font is plain. public boolean isBold() // Font class Tests a font for a bold font style. Returns true if the font is bold. public boolean isItalic() // Font class Tests a font for an italic font style. Returns true if the font is italic. public Font getFont() // Graphics class Returns a Font object reference representing the current font. public void setFont( Font f ) // Graphics class Sets the current font to the font, style and size specified by the Font object reference f. Fig. 11.8 Font methods, c onstants and font-related Graphics methods (Part 2 of 2). Font类常量和相关的绘图方法