⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgl.java

📁 彩票号码生成器
💻 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;
  Box basebox,boxh1;
  boolean qq=false;
  Thread thread;
  int k=1;
   caipiao()
   {super("单注彩票号码生成器");
   setSize(100,100);
   setBounds(500,300,300,100);
   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);
   text1.setText("8");
   text2.setText("8");
   text3.setText("8");
   text4.setText("8");
   text5.setText("8");
   text6.setText("8");
   text7.setText("8");
   button=new Button("开始");
   boxh1=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);
    boxh1.add(Box.createHorizontalGlue());
    basebox.add(boxh1);
    basebox.add(Box.createVerticalGlue());
    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));
              }
        
   } 
   
 }
 public class cgl
 { public   static void main(String hh[])
   {caipiao hhw=new caipiao();
   }
 }  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -