自定义随机抽取学号java程序
(可自定义总人数与所需人数)
import java.io.;
import javax.swing.;
import java.util.;
import jxl.;
import java.awt.;
import java.awt.event.;
public class ReadText
{
public static void main(String args[])
{
WindowStudent win=new WindowStudent();
win.setBounds(100,100,410,360);
win.setTitle(“随机点名”);
}
}
class WindowStudent extends JFrame implements ActionListener
{
Student student;
JTextField textA,textB;
JTextArea showArea;
JButton controlButton;
WindowStudent(){
init();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
void init(){
student=new Student();
textA=new JTextField(5);
textB=new JTextField(5);
showArea=new JTextArea();
Java代码随机产生学号
最新推荐文章于 2024-03-22 22:56:37 发布
这是一个使用Java编写的程序,能够自定义总人数和需要随机抽取的人数,用于实现随机点名功能。通过`GetRandomNumber`类生成不重复的随机数,作为学号,显示在`JTextArea`中。
摘要由CSDN通过智能技术生成