我想定义一个Font,但编译器说找不到FACE_SYSTEM,STYLE_BOLD和SIZE_MEDIUM,请问是什么原因?是不是没有import那一个包?
import java.awt.Font;
Font game_info_font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
------解决方案--------------------
Font:
Modifier and Type Field and Description
static int BOLD
The bold style constant.
static int CENTER_BASELINE
The baseline used in ideographic scripts like Chinese, Japanese, and Korean when laying out text.
static String DIALOG
A String constant for the canonical family name of the logical font "Dialog".
static String DIALOG_INPUT
A String constant for the canonical family name of the logical font "DialogInput".
static int HANGING_BASELINE
The baseline used in Devanigiri and similar scripts when laying out text.
static int ITALIC
The italicized style constant.
static int LAYOUT_LEFT_TO_RIGHT
A flag to layoutGlyphVector indicating that text is left-to-right as determined by Bidi analysis.
static int LAYOUT_NO_LIMIT_CONTEXT
A flag to layoutGlyphVector indicating that text in the char array after the indicated limit should not be examined.
static int LAYOUT_NO_START_CONTEXT
A flag to layoutGlyphVector indicating that text in the char array before the indicated start should not be examined.
static int LAYOUT_RIGHT_TO_LEFT
A flag to layoutGlyphVector indicating that text is right-to-left as determined by Bidi analysis.
static String MONOSPACED
A String constant for the canonical family name of the logical font "Monospaced".
protected String name
The logical name of this Font, as passed to the constructor.
static int PLAIN
The plain style constant.
protected float pointSize
The point size of this Font in float.
static int ROMAN_BASELINE
The baseline used in most Roman scripts when laying out text.
static String SANS_SERIF
A String constant for the canonical family name of the logical font "SansSerif".
static String SERIF
A String constant for the canonical family name of the logical font "Serif".
protected int size
The point size of this Font, rounded to integer.
protected int style
The style of this Font, as passed to the constructor.
static int TRUETYPE_FONT
Identify a font resource of type TRUETYPE.
static int TYPE1_FONT
Identify a font resource of type TYPE1.
看看有没有你那个。还有import进来没有?
http://docs.oracle.com/javase/7/docs/api/java/awt/Font.html