资源描述:
《JAVA数字拼图游戏》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、importjava.awt.*;importjava.awt.event.*;importjava.util.*;importjava.text.SimpleDateFormat;importjava.awt.Point;importjava.lang.*;importjava.math.*;importjava.sql.*;importjava.io.*;importjava.io.File;importjava.net.URL;importjava.applet.*;classMyWindowListenerextendsWindo
2、wAdapter{publicvoidwindowClosing(WindowEvente)//正在关闭窗口时{e.getWindow().setVisible(false);((Window)e.getComponent()).dispose();System.exit(0);}}classMyButtonListener4implementsActionListener//排行榜对话框“确认”和出错“确定”按钮事件响应{publicvoidactionPerformed(ActionEvente){Dialogd=(Dialog)((
3、Button)e.getSource()).getParent();d.setVisible(false);d.dispose();}}classMyWindowListener5extendsWindowAdapter//关闭子窗口事件响应{publicvoidwindowClosing(WindowEvente){e.getWindow().setVisible(false);((Window)e.getComponent()).dispose();}}classErrorDialogextendsDialog//出错对话框{priv
4、ateStringstr;publicErrorDialog(Dialogowner,Strings){super(owner);str=s;}publicvoidinit(){setTitle("出错");setModal(true);setBounds(500,200,400,150);setResizable(false);Buttonb=newButton("确定");b.setFont(newFont("隶书",Font.BOLD,20));b.setBounds(170,100,60,30);setLayout(null);a
5、dd(b);b.addActionListener(newMyButtonListener4());addWindowListener(newMyWindowListener5());setVisible(true);}publicvoidpaint(Graphicsg){g.setFont(newFont("楷体",Font.BOLD,20));g.drawString(str,20,60);}}classPaiHangDialogextendsDialog//排行榜对话框{privateLabell[];publicPaiHangDi
6、alog(Dialogowner){super(owner);setTitle("排行榜");setModal(true);setBounds(500,200,200,400);setResizable(false);Buttonb=newButton("关闭");b.setFont(newFont("隶书",Font.BOLD,10));b.setBounds(100,360,60,30);setLayout(null);add(b);l=newLabel[5];for(inti=0;i<5;i++){l[i]=newLabel("")
7、;add(l[i]);l[i].setBounds(25,50+i*45,150,30);l[i].setBackground(Color.yellow);l[i].setForeground(Color.red);}b.addActionListener(newMyButtonListener4());addWindowListener(newMyWindowListener5());}publicvoidSetText(Strings[]){for(inti=0;i<5;i++){l[i].setText(s[i]);}setVisi
8、ble(true);}}classChengJiDialogextendsDialog//记录成绩对话框{privatePaiHangph=newPaiHang();privateLabell