?? help.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 + -