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

📄 f0e9e36cb25d001c128ced76f2f6da6d

📁 QQ连连看游戏源码。完全仿照QQ游戏中的连连看制作的单机版游戏。
💻
字号:
package cn.nawang.test;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class AboutDialogBuilder {
	private UI FrameUI;
	public AboutDialogBuilder(UI FrameUI) {
		// TODO Auto-generated constructor stub
		this.FrameUI = FrameUI;
	}
	public void initAboutDialog(UI FrameUI, AboutEventHandler handler)
	{
		this.FrameUI.aboutDialog = this.createAboutDialog(FrameUI);
		this.FrameUI.aboutTxt = this.createAboutTxt(FrameUI);
		this.FrameUI.closeAboutDialogBtn = this.createCloseBtn(FrameUI, "Close", handler);
		this.FrameUI.pictureLabel = this.createPictureLabel(FrameUI);
		this.layoutAboutDialog(FrameUI);
	}
	public JDialog createAboutDialog(UI FrameUI)
	{
		JDialog aboutDialog = new JDialog(FrameUI.mainFrame, "About");
		aboutDialog.setVisible(false);
		aboutDialog.setSize(new Dimension(400, 320));
		return aboutDialog;
	}
	public JButton createCloseBtn(UI FrameUI, String btnName, AboutEventHandler handler)
	{
		JButton closeAboutDialogBtn = new JButton(btnName);
		closeAboutDialogBtn.addActionListener(handler);
		return closeAboutDialogBtn;
	}
	public JLabel createPictureLabel(UI FrameUI)
	{
		JLabel pictureLabel = new JLabel();
		ImageIcon myPic = new ImageIcon("cn/nawang/image/myPic.gif");
		//pictureBtn.setPreferredSize(new Dimension(142, 228));
		pictureLabel.setIcon(myPic);
		return pictureLabel;
	}
	public JEditorPane createAboutTxt(UI FrameUI)
	{
		JEditorPane aboutTxt = new JEditorPane();
		aboutTxt.setContentType("text/html");
		aboutTxt.setText(Doc.aboutTxt);
		aboutTxt.setEditable(false);
		//aboutTxt.setPreferredSize(new Dimension(250, 228));
		aboutTxt.setBackground(new Color(0xeeeeee));
		return aboutTxt;
	}
	public void layoutAboutDialog(UI FrameUI)
	{
//		FrameUI.picturePanel = new JPanel();
//		FrameUI.picturePanel.setLayout(new FlowLayout());
//		FrameUI.picturePanel.add(FrameUI.pictureLabel);
		JPanel closePanel = new JPanel(new FlowLayout());
		closePanel.add(FrameUI.closeAboutDialogBtn);
		JScrollPane aboutTxtScrollPane = new JScrollPane(FrameUI.aboutTxt);
		aboutTxtScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		aboutTxtScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		FrameUI.aboutDialog.getContentPane().setLayout(new BorderLayout());
//		FrameUI.aboutDialog.getContentPane().add(FrameUI.picturePanel, BorderLayout.WEST);
		FrameUI.aboutDialog.getContentPane().add(FrameUI.pictureLabel, BorderLayout.WEST);
		FrameUI.aboutDialog.getContentPane().add(aboutTxtScrollPane, BorderLayout.EAST);
		FrameUI.aboutDialog.getContentPane().add(closePanel, BorderLayout.SOUTH);
	}

}

⌨️ 快捷键说明

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