資源簡介
Java入門-3D文字(實例27).zip
代碼片段和文件信息
import?java.applet.applet;
import?java.awt.*;
public?class?Text3Dapplet?extends?applet?implements?Runnable?{
Image?image;?//繪制文字的Image對象
Graphics?graphics;?//繪制文字的Graphics對象
Thread?thread;??//顯示三維文字線程
int?widthheight;?//顯示寬度、高度
String?message;?//顯示信息
int?fontSize;?//文字尺寸
Font?font;?//字體
public?void?init()?{
Dimension?dim=getSize();?//得到applet的尺寸
width?=?dim.width;?//得到寬度
height?=?dim.height;?//得到高度
image?=?createImage(width?height);?//得到Image實例
graphics=?image.getGraphics();?//得到Grahpics實例
message?=?getParameter(“text“);?//從HTML文件中得到顯示信息
if?(message?==?null)?{?//如果信息為空
message=“三維文字“;?//設置默認信息
}
fontSize?=?30;?//設置字體大小
}
public?void?start()?{?
if?(thread?==?null)?{
thread?=?new?Thread(this);??//實例化線程
thread.start();?//運行線程
}
}
public?void?run()?{?//線程運行主體
while?(thread?!=?null)?{
try?{
Thread.sleep(50L);?//線程休眠
}?catch?(InterruptedException?ex)?{
}
repaint();?//重繪屏幕
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????163014??2004-05-14?16:54??33-1.bmp
?????文件?????????199??2004-05-14?16:55??3DText.html
?????文件????????2199??2004-05-17?23:53??Text3Dap
?????文件????????1996??2004-05-17?23:53??Text3Dap
評論
共有 條評論