java代码高大上写法 怎么写好java代码( 二 )


int j5 = (int) (Math.random() * 10) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * 10) % 6;
l6.setText(num2[j6]);
if (j1 == j2j2 == j3 || j4 == j5j5 == j6 || j1 == 1
j2 == 2j3 == 3j4 == 4j5 == 5j6 == 6
|| j1 == 6j2 == 5j3 == 4j4 == 3j5 == 2
j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1j2j2j3 || j3j2j2j1 || j4j5
j5j6 || j6j5j5j4 || j1 == j2
j5 == j4 || j1 == j2j5 == j6 || j3 == j2
j4 == j5 || j5 == j6j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * 10) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * 10) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * 10) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * 10) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * 10) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * 10) % 6;
l6.setText(num2[j6]);
if (j1 == j2j2 == j3 || j4 == j5j5 == j6 || j1 == 1
j2 == 2j3 == 3j4 == 4j5 == 5j6 == 6
|| j1 == 6j2 == 5j3 == 4j4 == 3j5 == 2
j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1j2j2j3 || j3j2j2j1 || j4j5
j5j6 || j6j5j5j4 || j1 == j2
j5 == j4 || j1 == j2j5 == j6 || j3 == j2
j4 == j5 || j5 == j6j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * 10) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * 10) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * 10) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * 10) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * 10) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * 10) % 6;
l6.setText(num2[j6]);
if (j1 == j2j2 == j3 || j4 == j5j5 == j6 || j1 == 1
j2 == 2j3 == 3j4 == 4j5 == 5j6 == 6
|| j1 == 6j2 == 5j3 == 4j4 == 3j5 == 2
j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1j2j2j3 || j3j2j2j1 || j4j5
j5j6 || j6j5j5j4 || j1 == j2
j5 == j4 || j1 == j2j5 == j6 || j3 == j2
j4 == j5 || j5 == j6j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * 10) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * 10) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * 10) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * 10) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * 10) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * 10) % 6;
l6.setText(num2[j6]);
if (j1 == j2j2 == j3 || j4 == j5j5 == j6 || j1 == 1
j2 == 2j3 == 3j4 == 4j5 == 5j6 == 6
|| j1 == 6j2 == 5j3 == 4j4 == 3j5 == 2
j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1j2j2j3 || j3j2j2j1 || j4j5
j5j6 || j6j5j5j4 || j1 == j2

推荐阅读