import java.awt.*;
import java.awt.event.*;
import java.util.Random; public class Test { public static void main(String[] args) { new StartPro().launchFrame();
}
} class StartPro {
TextField tf, tf1;
String str = ""; public void launchFrame() { Frame f = new Frame("双色球机随机选号包你不中");
f.setLayout(new FlowLayout());
Random rand = new Random(); for (int i = 0; i < 6; i++) { str = ("" + rand.nextInt(33));
tf = new TextField();
f.add(tf);
tf.setText(str); }
Label lb = new Label("+");
f.add(lb);
tf1 = new TextField();
f.add(tf1);
tf1.setText("" + rand.nextInt(16));
Button b1 = new Button(" < < < < < < < < < < 机选下一注 >>>>>>>>>>");
f.add(b1);
// f.add(b2);
f.setSize(340, 100);
f.setVisible(true); }
} class CEvent implements ActionListener {
StartPro strp = null; CEvent(StartPro strp) {
this.strp = strp;
} @Override
public void actionPerformed(ActionEvent e) {
// strp.cstr();
} } 我想点下一注的时候它再设置下一注随机怎么实现阿。我头都整大了也没搞好。大家帮帮忙。
import java.awt.event.*;
import java.util.Random; public class Test { public static void main(String[] args) { new StartPro().launchFrame();
}
} class StartPro {
TextField tf, tf1;
String str = ""; public void launchFrame() { Frame f = new Frame("双色球机随机选号包你不中");
f.setLayout(new FlowLayout());
Random rand = new Random(); for (int i = 0; i < 6; i++) { str = ("" + rand.nextInt(33));
tf = new TextField();
f.add(tf);
tf.setText(str); }
Label lb = new Label("+");
f.add(lb);
tf1 = new TextField();
f.add(tf1);
tf1.setText("" + rand.nextInt(16));
Button b1 = new Button(" < < < < < < < < < < 机选下一注 >>>>>>>>>>");
f.add(b1);
// f.add(b2);
f.setSize(340, 100);
f.setVisible(true); }
} class CEvent implements ActionListener {
StartPro strp = null; CEvent(StartPro strp) {
this.strp = strp;
} @Override
public void actionPerformed(ActionEvent e) {
// strp.cstr();
} } 我想点下一注的时候它再设置下一注随机怎么实现阿。我头都整大了也没搞好。大家帮帮忙。
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;public class Test { public static void main(String[] args) { new StartPro().launchFrame();
}
}class StartPro implements ActionListener {
TextField tf, tf2, tf3, tf4, tf5, tf6, tf1; String str = ""; Random rand = new Random(); Frame f = new Frame("双色球机随机选号包你不中"); public void launchFrame() { tf = new TextField();
tf2 = new TextField();
tf3 = new TextField();
tf4 = new TextField();
tf5 = new TextField();
tf6 = new TextField(); f.setLayout(new FlowLayout()); tf.setText(rand.nextInt(33) + "");
tf2.setText(rand.nextInt(33) + "");
tf3.setText(rand.nextInt(33) + "");
tf4.setText(rand.nextInt(33) + "");
tf5.setText(rand.nextInt(33) + "");
tf6.setText(rand.nextInt(33) + ""); f.add(tf);
f.add(tf2);
f.add(tf3);
f.add(tf4);
f.add(tf5);
f.add(tf6); Label lb = new Label("+");
f.add(lb);
tf1 = new TextField();
f.add(tf1);
tf1.setText("" + rand.nextInt(16));
Button b1 = new Button(" < < < < < < < < < < 机选下一注 >>>>>>>>>>");
b1.addActionListener(this);
f.add(b1);
f.setSize(340, 100);
f.setVisible(true);
f.setResizable(false);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
} public void actionPerformed(ActionEvent e) {
tf.setText(rand.nextInt(33) + "");
tf2.setText(rand.nextInt(33) + "");
tf3.setText(rand.nextInt(33) + "");
tf4.setText(rand.nextInt(33) + "");
tf5.setText(rand.nextInt(33) + "");
tf6.setText(rand.nextInt(33) + "");
tf1.setText("" + rand.nextInt(16));
}
}
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.Random; public class Test
{
public static void main(String[] args)
{
new StartPro();
}
} class StartPro implements ActionListener
{
JTextField tf1;
JTextField[] tf;
String str = ""; public StartPro()
{
JFrame f = new JFrame("双色球机随机选号包你不中");
f.setLayout(new FlowLayout());
Random rand = new Random();
tf= new JTextField[6];
for (int i = 0; i < 6; i++)
{
str = ("" + rand.nextInt(33));
tf[i] = new JTextField(3);
f.add(tf[i]);
tf[i].setText(str);
}
Label lb = new Label("+");
f.add(lb);
tf1 = new JTextField(3);
f.add(tf1);
tf1.setText("" + rand.nextInt(16));
Button b1 = new Button(" < < < < < < < < < < 机选下一注 >>>>>>>>>>");
b1.addActionListener(this);
f.add(b1);
f.setSize(340, 100);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String str;
Random rand = new Random();
for(int i=0;i<6;i++)
{
str = ("" + rand.nextInt(33));
tf[i].setText(str);
}
tf1.setText("" + rand.nextInt(33));
}
}