📄 cgl.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.StringTokenizer;
class caipiao extends Frame implements ActionListener,Runnable
{
Button button;
TextField text1,text2,text3,text4,text5,text6,text7,text8,text9,text10,text11,text12,text13,text14,text15,text16,text17,text18,text19,text20,text21,text22,text23,text24,text25,text26,text27,text28,text29,text30,text31,text32,text33,text34,text35;
Box basebox,boxh1,boxh2,boxh3,boxh4,boxh5;
boolean qq=false;
Thread thread;
int k=1;
caipiao()
{super("5注彩票号码生成器");
setSize(100,100);
setBounds(500,300,300,250);
setVisible(true);
setResizable(false);
setBackground(Color.cyan);
thread=new Thread(this);
text1=new TextField(1);
text2=new TextField(1);
text3=new TextField(1);
text4=new TextField(1);
text5=new TextField(1);
text6=new TextField(1);
text7=new TextField(1);
text8=new TextField(1);
text9=new TextField(1);
text10=new TextField(1);
text11=new TextField(1);
text12=new TextField(1);
text13=new TextField(1);
text14=new TextField(1);
text15=new TextField(1);
text16=new TextField(1);
text17=new TextField(1);
text18=new TextField(1);
text19=new TextField(1);
text20=new TextField(1);
text21=new TextField(1);
text22=new TextField(1);
text23=new TextField(1);
text24=new TextField(1);
text25=new TextField(1);
text26=new TextField(1);
text27=new TextField(1);
text28=new TextField(1);
text29=new TextField(1);
text30=new TextField(1);
text31=new TextField(1);
text32=new TextField(1);
text33=new TextField(1);
text34=new TextField(1);
text35=new TextField(1);
text1.setText("8");
text2.setText("8");
text3.setText("8");
text4.setText("8");
text5.setText("8");
text6.setText("8");
text7.setText("8");
text1.setText("8");
text2.setText("8");
text3.setText("8");
text4.setText("8");
text5.setText("8");
text6.setText("8");
text7.setText("8");
text8.setText("8");
text9.setText("8");
text10.setText("8");
text11.setText("8");
text12.setText("8");
text13.setText("8");
text14.setText("8");
text15.setText("8");
text16.setText("8");
text17.setText("8");
text18.setText("8");
text19.setText("8");
text20.setText("8");
text21.setText("8");
text22.setText("8");
text23.setText("8");
text24.setText("8");
text25.setText("8");
text26.setText("8");
text27.setText("8");
text28.setText("8");
text29.setText("8");
text30.setText("8");
text31.setText("8");
text32.setText("8");
text33.setText("8");
text34.setText("8");
text35.setText("8");
button=new Button("开始");
boxh1=Box.createHorizontalBox();
boxh2=Box.createHorizontalBox();
boxh3=Box.createHorizontalBox();
boxh4=Box.createHorizontalBox();
boxh5=Box.createHorizontalBox();
basebox=Box.createVerticalBox();
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text1);
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text2);
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text3);
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text4);
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text5);
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text6);
boxh1.add(Box.createHorizontalGlue());
boxh1.add(text7);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text8);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text9);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text10);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text11);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text12);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text13);
boxh2.add(Box.createHorizontalGlue());
boxh2.add(text14);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text15);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text16);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text17);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text18);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text19);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text20);
boxh3.add(Box.createHorizontalGlue());
boxh3.add(text21);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text22);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text23);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text24);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text25);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text26);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text27);
boxh4.add(Box.createHorizontalGlue());
boxh4.add(text28);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text29);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text30);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text31);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text32);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text33);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text34);
boxh5.add(Box.createHorizontalGlue());
boxh5.add(text35);
basebox.add(boxh1);
basebox.add(Box.createVerticalGlue());
basebox.add(boxh2);
basebox.add(Box.createVerticalGlue());
basebox.add(boxh3);
basebox.add(Box.createVerticalGlue());
basebox.add(boxh4);
basebox.add(Box.createVerticalGlue());
basebox.add(boxh5);
basebox.add(button);
add(basebox);
button.addActionListener(this);
button.setBackground(Color.cyan);
addWindowListener (new WindowAdapter()
{public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
validate();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button)
{if(qq==false)
{button.setLabel("暂停");
qq=true;
if(k==1)
thread.start();
else
thread.resume();
}
else if(qq==true)
{button.setLabel("开始");
qq=false;
k=2;
thread.suspend();
}
}
}
public void run()
{
while(true)
{text1.setText(String.valueOf((int)(Math.random()*9+2)%10));
text2.setText(String.valueOf((int)(Math.random()*9+2)%10));
text3.setText(String.valueOf((int)(Math.random()*9+2)%10));
text4.setText(String.valueOf((int)(Math.random()*9+2)%10));
text5.setText(String.valueOf((int)(Math.random()*9+2)%10));
text6.setText(String.valueOf((int)(Math.random()*9+2)%10));
text7.setText(String.valueOf((int)(Math.random()*9+2)%10));
text8.setText(String.valueOf((int)(Math.random()*9+2)%10));
text9.setText(String.valueOf((int)(Math.random()*9+2)%10));
text10.setText(String.valueOf((int)(Math.random()*9+2)%10));
text11.setText(String.valueOf((int)(Math.random()*9+2)%10));
text12.setText(String.valueOf((int)(Math.random()*9+2)%10));
text13.setText(String.valueOf((int)(Math.random()*9+2)%10));
text14.setText(String.valueOf((int)(Math.random()*9+2)%10));
text15.setText(String.valueOf((int)(Math.random()*9+2)%10));
text16.setText(String.valueOf((int)(Math.random()*9+2)%10));
text17.setText(String.valueOf((int)(Math.random()*9+2)%10));
text18.setText(String.valueOf((int)(Math.random()*9+2)%10));
text19.setText(String.valueOf((int)(Math.random()*9+2)%10));
text20.setText(String.valueOf((int)(Math.random()*9+2)%10));
text21.setText(String.valueOf((int)(Math.random()*9+2)%10));
text22.setText(String.valueOf((int)(Math.random()*9+2)%10));
text23.setText(String.valueOf((int)(Math.random()*9+2)%10));
text24.setText(String.valueOf((int)(Math.random()*9+2)%10));
text25.setText(String.valueOf((int)(Math.random()*9+2)%10));
text26.setText(String.valueOf((int)(Math.random()*9+2)%10));
text27.setText(String.valueOf((int)(Math.random()*9+2)%10));
text28.setText(String.valueOf((int)(Math.random()*9+2)%10));
text29.setText(String.valueOf((int)(Math.random()*9+2)%10));
text30.setText(String.valueOf((int)(Math.random()*9+2)%10));
text31.setText(String.valueOf((int)(Math.random()*9+2)%10));
text32.setText(String.valueOf((int)(Math.random()*9+2)%10));
text33.setText(String.valueOf((int)(Math.random()*9+2)%10));
text34.setText(String.valueOf((int)(Math.random()*9+2)%10));
text35.setText(String.valueOf((int)(Math.random()*9+2)%10));
}
}
}
public class cgl
{ public static void main(String hh[])
{caipiao hhw=new caipiao();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -