浪漫告白程序Java文档格式.doc
《浪漫告白程序Java文档格式.doc》由会员分享,可在线阅读,更多相关《浪漫告白程序Java文档格式.doc(2页珍藏版)》请在冰点文库上搜索。
w.setSize(1366,768);
w.setBackground(Color.BLACK);
MyPanelmp=newMyPanel();
mp.setBackground(Color.BLACK);
w.add(mp);
Threadt=newThread(mp);
t.start();
w.show();
}
}
classMyPanelextendsJPanelimplementsRunnable{
finalintlen=400;
publicvoidpaint(Graphicsg){
g.setColor(Color.WHITE);
for(inti=0;
i<
len;
i++){
g.drawString("
*"
(int)(Math.random()*1366),(int)(Math.random()*768));
}
g.setColor(Color.BLACK);
Fontf=newFont("
宋体"
Font.BOLD,40);
g.setFont(f);
g.drawString("
我爱你,不是说说而已"
450,600);
intx1[]={800,770,850,750,830};
inty1[]={60,160,100,100,160};
g.fillPolygon(x1,y1,x1.length);
intx2[]={600,570,650,550,630};
inty2[]={300,400,340,340,400};
g.fillPolygon(x2,y2,x2.length);
intx3[]={60,30,110,10,90};
inty3[]={60,160,100,100,160};
g.fillPolygon(x3,y3,x3.length);
intx4[]={1300,1270,1350,1250,1330};
inty4[]={300,400,340,340,400};
g.fillPolygon(x4,y4,x4.length);
@Override
publicvoidrun(){
//TODOAuto-generatedmethodstub
while(true){
try{Thread.sleep(40);
catch(Exceptione){}
repaint();