该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
package com.wgh;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import com.lzw.BackgroundPanel;
import com.swtdesigner.SwingResourceManager;
import com.wgh.Number;
public class MainFrame extends JFrame {
public boolean scrollFlag = false; // 是否滚动
public static void main(String args[]) {
MainFrame frame = new MainFrame();
frame.setVisible(true);
}
public MainFrame() {
super();
getContentPane().setLayout(null);
setTitle("体育彩票七星彩摇奖机");
setBounds(100, 100, 411, 235);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final BackgroundPanel backgroundPanel = new BackgroundPanel();
backgroundPanel.setBounds(0, 0, 403, 201);
backgroundPanel.setImage(SwingResourceManager.getImage(MainFrame.class, "/images/background.JPG"));
getContentPane().add(backgroundPanel);
final Number number[] = new Number[7]; // 声明一个包括7个元素的数组
for (int i = 0; i < 7; i++) {
number[i] = new Number(); // 实例化一个显示随机数的标签对象
number[i].setText(String.valueOf(i)); // 设置标签的显示文本
number[i].setFont(new Font("", Font.PLAIN, 24));//设置字体
number[i].setForeground(new Color(255, 255, 255));//设置颜色
number[i].setBounds(67 + 42 * i, 85, 14, 18); // 设置标签的位置
backgroundPanel.add(number[i]); // 添加一个Number类的对象,即一个显示随机数的标签
}
final JButton start_button = new JButton();
start_button.setContentAreaFilled(false);
start_button.setBorderPainted(false);
start_button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
start_button.setRolloverIcon(SwingResourceManager.getIcon(MainFrame.class, "/images/开始按下.png"));
start_button.setIcon(SwingResourceManager.getIcon(MainFrame.class, "/images/开始.png"));
start_button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (!scrollFlag) {//如果没有滚动
scrollFlag = true; // 设置状态变量为true,用于记录已经滚动
for (int i = 0; i < 7; i++) {
number[i].startSortition(); // 开始滚动
}
}
}
});
start_button.setBounds(219, 117, 73, 78);
backgroundPanel.add(start_button);
final JButton stop_button = new JButton();
stop_button.setContentAreaFilled(false);
stop_button.setBorderPainted(false);
stop_button.setIcon(SwingResourceManager.getIcon(MainFrame.class, "/images/停止.png"));
stop_button.setRolloverIcon(SwingResourceManager.getIcon(MainFrame.class, "/images/停止按下.png"));
stop_button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
stop_button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (scrollFlag) {//如果已经滚动
scrollFlag = false; // 设置状态变量为false,用于记录停止滚动
for (int i = 0; i < 7; i++) {
number[i].stopThread(); // 停止滚动
}
}
}
});
stop_button.setBounds(298, 117, 73, 78);
backgroundPanel.add(stop_button);
}
}
System.out.println(裙子190719525);