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

📄 d0867e1aac5d001c128ced76f2f6da6d

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

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.io.IOException;

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

public class HelpDialogBuilder {

	UI FrameUI;
	public HelpDialogBuilder(UI FrameUI) {
		// TODO Auto-generated constructor stub
		this.FrameUI = FrameUI;
	}
	public void initHelpDialog(UI FrameUI, HelpEventHandler handler, String text)
	{
		FrameUI.helpDialog = this.createHelpDialog(FrameUI);
		FrameUI.closeHelpDialogBtn = this.createCloseBtn(FrameUI, "Close", handler);
		FrameUI.helpTxt = this.createHelpTxt(FrameUI, text);
		this.layoutHelpDialog(FrameUI);
	}
	public JDialog createHelpDialog(UI FrameUI)
	{
		JDialog helpDialog = new JDialog(FrameUI.mainFrame, "Help");
		helpDialog.setSize(new Dimension(400, 320));
		helpDialog.setVisible(false);
		return helpDialog;		
	}
	public JButton createCloseBtn(UI FrameUI, String btnName, HelpEventHandler handler)
	{
		JButton closeBtn = new JButton(btnName);
		closeBtn.addActionListener(handler);
		//closeBtn.setPreferredSize(new Dimension(40, 20));
		return closeBtn;
	}
	public JEditorPane createHelpTxt(UI FrameUI, String helpText) 
	{
		JEditorPane helpTxt = new JEditorPane();
		FrameUI.scrollPane = new JScrollPane(helpTxt);
		FrameUI.scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		FrameUI.scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		helpTxt.setContentType("text/html");
		helpTxt.setText(Doc.helpDoc);
		helpTxt.setEditable(false);
		helpTxt.setBackground(new Color(0xeeeeee));
		return helpTxt;
	}
	public void layoutHelpDialog(UI FrameUI)
	{
		//JPanel panel = new JPanel();
		//panel.setPreferredSize(new Dimension(400, 320));
		//panel.add(FrameUI.helpTxt);
		FrameUI.scrollPane.getViewport().add(FrameUI.helpTxt);
		JPanel closePanel = new JPanel(new FlowLayout());
		closePanel.add(FrameUI.closeHelpDialogBtn);
		FrameUI.helpDialog.getContentPane().setLayout(new BorderLayout(0, 10));
		FrameUI.helpDialog.getContentPane().add(FrameUI.scrollPane, BorderLayout.CENTER);
		//FrameUI.helpDialog.getContentPane().add(panel, )
		FrameUI.helpDialog.getContentPane().add(closePanel, BorderLayout.SOUTH);
	}
	

}

⌨️ 快捷键说明

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