public abstract void drawString(String str, int x, int y) Draws the text given by the specified string, using this graphics context's current font and color. The baseline of the leftmost character is at position (x, y) in this graphics context's coordinate system. Parameters: str - the string to be drawn. x - the x coordinate. y - the y coordinate.
int x,
int y)
Draws the text given by the specified string, using this graphics context's current font and color. The baseline of the leftmost character is at position (x, y) in this graphics context's coordinate system. Parameters:
str - the string to be drawn.
x - the x coordinate.
y - the y coordinate.
g.drawString("当前日期"+t.getTime(),40,80);
drawString的参数只有3个。
{
Calendar t = cal.getInstance();
return t.get(t.YEAR)+"年"+(t.get(t.MONTH)+1)+"月"+t.get(t.DATE)+"日";
}
public String getTime()
{
Calendar t = cal.getInstance();
String s=t.get(t.HOUR)+"小时"+t.get(t.MINUTE)+"分钟"+t.get(t.SECOND)+"秒";
return s;
}