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

📄 help.java

📁 一个打地鼠的小游戏
💻 JAVA
字号:
import javax.swing.*;
import java.awt.event.*;


public class Help implements ActionListener{
		JTextArea outputArea=new JTextArea(12,8);
		JScrollPane jsp=new JScrollPane(outputArea,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

		String outputRule="In this game,you will totally have ten chances to kill the rat and with each right click you will have your score added ten." +
				"However ,if you have clicked at the cat or the dog ,you will have your chances decreased one .When you chances are down to zero ,you will " +
				"lose !"+"Have a try!";		
		String outputAbout="This is a open source game by XinXin . You are legal to distribute and to modify it at your wish . " +
				" I will be glad that if you can improve it . By the way , if you have any good advice or any unique suggestions , please contact me. " +
				"QQ:715429766";
		String outputMore="This is a free and open source program in Java."+"And it is under the spirit of ubuntu.";
		//Declare an object of class KillRat
		KillRat gui;
		//Constructor of class Help
		public Help(KillRat in){
			gui=in;
		}
		//The methods used in the method actionPerformed()
		public void showRule(){
			outputArea.setText(outputRule);
			outputArea.setLineWrap(true);
			JOptionPane.showMessageDialog(null,jsp,"Rule",JOptionPane.PLAIN_MESSAGE);
				
		}
		public void showAbout(){
			outputArea.setText(outputAbout);
			outputArea.setLineWrap(true);
			JOptionPane.showMessageDialog(null,jsp,"About",JOptionPane.PLAIN_MESSAGE);
		}
		public void showMore(){
			outputArea.setText(outputMore);
			outputArea.setLineWrap(true);
			JOptionPane.showMessageDialog(null,jsp,"More",JOptionPane.PLAIN_MESSAGE);
		}
		//action Performance
		public void actionPerformed(ActionEvent ae){
			if(ae.getActionCommand()=="Rule"){
				showRule();
			}
			else if(ae.getActionCommand()=="About"){
				showAbout();
			}
			else if(ae.getActionCommand()=="More"){
				showMore();
			}
		}
		
		
}



⌨️ 快捷键说明

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