如何让数字看起来像电影《黑客帝国》中的数字一样,带有一定的缩进,最好是绿色。所以我做了一个循环,说我想重复这个动作几百次,但i
我只输出一部分数字,而不是指定的变量数。
import javax.swing.*;
import java.awt.*;
import java.util.Random;
public class BigProject extends JFrame {
public static void main(String[] args) throws Exception {
int R = 0;
int G = 255;
int B = 0;
int repeat = 250;
JFrame j = new JFrame();
Robot robot = new Robot();
Random random = new Random();
j.getContentPane().setBackground(Color.BLACK);
j.setExtendedState(Frame.MAXIMIZED_BOTH);
j.setDefaultCloseOperation(EXIT_ON_CLOSE);
j.setTitle("Matrix");
j.setLayout(new FlowLayout());
j.setVisible(true);
FlowLayout setting = new FlowLayout(0, 0, 0);
j.getContentPane().setLayout(setting);
for (int Repeat = 0;Repeat != repeat; Repeat++) {
int i = random.nextInt(10);
JLabel label = new JLabel(String.valueOf(i), JLabel.CENTER);
label.setPreferredSize(new Dimension(100, 60));
label.setFont(label.getFont().deriveFont(45.0F));
label.setVisible(true);
j.add(label);
}
}
}