import java.awt.Button; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Frame; import java.awt.Label; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Start extends Frame implements ActionListener{ private static Start s; private TextField leishu; private Label title,tishi1,tishi2,weizhi1,weizhi2; private Button ok,exit; private Start(String name){ super(name); setLayout(new FlowLayout());//布局方式(流布局) title=new Label(" 设置雷的个数 "); Font f=new Font("字体",3,30); title.setFont(f); add(title); weizhi1=new Label(" "); add(weizhi1); tishi1=new Label("输入雷的个数:"); add(tishi1); leishu=new TextField(10); add(leishu); weizhi2=new Label(" "); add(weizhi2); ok=new Button("确定"); ok.addActionListener(this); add(ok); exit=new Button("退出"); exit.addActionListener(this); add(exit); tishi2=new Label(" "); add(tishi2); setSize(400,300);//设置窗口大小 setVisible(true);//设置是否可见 setResizable(false);//设置是否可调整大小 } public void setView(){ setVisible(true);//设置是否可见 } public void actionPerformed(ActionEvent event) { // TODO Auto-generated method stub if(event.getSource()==ok){ try{ int shu=Integer.valueOf(leishu.getText()); if(shu<=0){ tishi2.setText(" 雷的个数必须介于0到25之间 "); }else if(shu>=25){ tishi2.setText(" 雷的个数必须介于0到25之间 "); }else{ tishi2.setText(" "); SaoLei.leishu=shu; SaoLei sl=SaoLei.getS(); sl.chushihua(); setVisible(false);//设置是否可见 SaoLei.main(null); } }catch(Exception e){ tishi2.setText(" 请输入0到25之间的正整数 "); } } if(event.getSource()==exit){ System.exit(0); } } public static void main(String args[]){ if(Start.s==null){ s=new Start("魏振松扫雷小游戏"); } s.setView(); } }

微信网友_7558124162764800 LV2
6月18日
张德志 LV9
2023年12月27日
jiemomo LV12
2023年10月19日
选了了 LV7
2021年12月14日
ꪜiρ LV1
2021年11月5日
dkgxan LV1
2021年8月18日
hong1577271912 LV1
2021年8月15日
miaosen LV1
2021年6月25日
pipichao LV6
2021年6月24日
awdawd LV1
2021年6月21日

微信网友_7558124162764800 LV2
6月18日
1214783085 LV1
6月17日
13605416728 LV5
2024年12月13日
张德志 LV9
2023年12月27日
zhihong fan LV2
2023年12月26日
lshlsh
2023年12月25日
暂无贡献等级
bangyiyang LV2
2023年12月21日
jiemomo LV12
2023年10月19日
fenghuijun LV26
2023年3月27日
wdasfgas
2022年11月27日
暂无贡献等级