java做的抽奖转盘
java课程设计 package com.lzw; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Demo extends JFrame { private final class ButtonActionListener implements ActionListener { private final ImagePanel imagePanel; private Thread imageThread; private ButtonActionListener(ImagePanel imagePanel) { this.imagePanel = imagePanel; } public void actionPerformed(final ActionEvent e) { if (imageThread == null || !imageThread.isAlive()) { imageThread = new Thread(imagePanel); imageThread.start(); } else if (!imageThread.isAlive()) { imageThread.start(); } } } public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { public void run() { try { Demo frame = new Demo(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public Demo() { super(); setTitle("抽奖大转盘"); setResizable(false); setBounds(100, 100, 700, 700); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ImagePanel imagePanel = new ImagePanel(); getContentPane().add(imagePanel, BorderLayout.CENTER); final JButton button = new JButton(); button.setCursor(Cursor .getPredefinedCursor(Cursor.HAND_CURSOR)); button.setPressedIcon(new ImageIcon(getClass() .getResource("bt2.png"))); button.setFocusPainted(false); button.setBorderPainted(false); button.addActionListener(new ButtonActionListener( imagePanel)); button.setIcon(new ImageIcon(getClass().getResource( "bt.png"))); button.setOpaque(false); button.setContentAreaFilled(false); button.setBorder(null); button.setBounds(277, 202, 139, 209); imagePanel.add(button); } }
- 1
- 粉丝: 1
- 资源: 1
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
- 1
- 2
- 3
- 4
- 5
- 6
前往页