⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aboutdialog.java

📁 eclipse下面实现的java扫雷游戏
💻 JAVA
字号:
/*
 * Created on 2005-5-10
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package view;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.border.BevelBorder;

/**
 * @author mqqqvpppm
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class AboutDialog {

	/**
	 *  
	 */
	public AboutDialog(JFrame parent) {
		super();
		initialization(parent);
	}

	public void show() {
		imagePanel.start();
		dialog.setVisible(true);

	}

	private void initialization(JFrame parent) {

		dialog = new JDialog(parent, "about", true);

		ok = new JButton("ok");
		ok.setFont(new Font("Monospaced", Font.PLAIN, 15));
		ok.setBounds(272, 170, 50, 30);
		ok.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dialog.setVisible(false);
				imagePanel.stop();
			}
		});

		line = new JSeparator();
		line.setBounds(10, 155, 310, 4);

		imagePanel = new ImagePanel(Images.createImage("images/ABOUT.jpg"));
		imagePanel.add(Images.createImage("images/ABOUT2.jpg"));
		imagePanel.add(Images.createImage("images/ABOUT3.jpg"));
		imagePanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
		imagePanel.setBackground(Color.WHITE);
		imagePanel.setBounds(220, 30, 100, 100);

		panel = new JPanel();
		panel.setLayout(null);
		panel.add(imagePanel);

		panel.add(new DescribeTextPanel());
		panel.add(new AuthorTextPanel());

		panel.add(ok);
		panel.add(line);

		dialog.setResizable(false);
		dialog.setContentPane(panel);
		dialog.setBounds(parent.getLocation().x + 50,
				parent.getLocation().y + 50, 350, 250);

	}

	private class AuthorTextPanel extends JPanel {

		AuthorTextPanel() {
			super();
			setBounds(0, 165, 250, 40);
		}

		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			g.setFont(new Font("Monospaced", Font.PLAIN, 12));
			g.drawString("Dedicate this program to my parents", 15, 10);
			g.drawString("and my girl friend.",15,28);
		}
	}

	private class DescribeTextPanel extends JPanel {

		DescribeTextPanel() {
			super();
			setBounds(0, 30, 200, 100);
		}

		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			
			g.setFont(new Font("Monospaced",Font.PLAIN,12));
			g.drawString("Authorization:", 15, 10);
			g.drawString("Free Use And Get Source Code", 30, 28);

			g.drawString("Version: 2.3.1", 15, 52);
			g.drawString("Author: mqqqvpppm", 15, 70);
			g.drawString("E-mail: mqqqvpppm@yahoo.com.cn", 15, 88);
		}
	}

	private ImagePanel imagePanel;

	private JDialog dialog;

	private JPanel panel;

	private JButton ok;

	private JSeparator line;

	private JLabel textLabel;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -