資源簡介
Java入門-伸展文字(實例30).zip
代碼片段和文件信息
import?java.awt.*;
import?java.applet.*;
//伸展文字
public?class?ExtendTextapplet?extends?applet?implements?Runnable{
Image?image;?//該applet的Image對象
Graphics?graphics;??//該applet的Graphics對象
int?appletWidthappletHeight;?//applet的高度寬度
String?message;?//顯示文本
Thread?thread;?//動畫線程
int?ypoint=0?xheight;?//顯示文本的Y坐標和高度
int?phase?=?0;?//狀態參數
Font?font;?//顯示文本的字體
public?void?init(){
font=new?Font(“TimesRoman“Font.BOLD30);?//實例化字體
appletWidth?=?getSize().width;?//得到applet的寬度
appletHeight?=?getSize().height;??//得到applet的高度
xheight?=?appletHeight?/?3;?//顯示文字高度值
ypoint?=?xheight;?//顯示文字的Y坐標值
message?=?getParameter(“Text“);?//得到顯示信息
if(message==null)
message?=?“伸展文字“;?//設置默認信息
image?=?createImage(appletWidthappletHeight);??//得到Image實例
graphics?=?image.getGraphics();??//得到Graphics實例
}??
??
public?void?start(){
if(thread?==?null){
thread?=?new?Thread(this);??//實例化線程
thread.start();??//運行線程
}
}?????
???
public?void?upd
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????143846??2004-05-14?18:01??36-1.bmp
?????文件??????143846??2004-05-14?18:01??36-2.bmp
?????文件?????????201??2004-05-13?18:45??ExtendText.HTML
?????文件????????2664??2004-05-19?00:31??ExtendTextap
?????文件????????3189??2004-05-19?00:30??ExtendTextap
評論
共有 條評論