?? about.java
字號:
package fyrad;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class About extends JDialog
{
private static final long serialVersionUID = 6143155427616963714L;
public JDialog About()
{
JDialog about=new JDialog();//說明文檔對話框
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JButton ok=new JButton("OK");
JTextArea ta1=new JTextArea("Connect Four,also called Four in a Row,is a two player's game which"+"\n"
+"place on a seven by six rectangular board.The goal is to get four"+"\n"
+"pieces of the same colour in a row.All directions count(horizontal,"+"\n"
+"vertical and diagonal)."+"\n"
+""+"\n"
+"In Fyrad(taken from the Swedish name Fyra i Rad)a move is made by"+"\n"
+"clicking in a column.Remember that the pieces fall down the column"+"\n"
+"until hit either the buttom or another piece.",10,35);
JTextArea ta2=new JTextArea("In Nomal Mode you can play against the computer or a friend."+"\n"
+""+"\n"
+"There are six different computer opponents(seven including radom),"+"\n"
+"where Stupid Joe is the weakest and the Super Pete is the strongest."+"\n"
+"You can select which level to use(or radom),ie the number of the"+"\n"
+"moves the computer will look ahead before each move."+"\n"
+""+"\n"
+"It is also possible to configure all opponents except Super Pete,"+"\n"
+"and to save/load settings and games.",10,35);
JTextArea ta3=new JTextArea("In Network Mode you can play against a friend over the internet or"+"\n"
+"over the local network."+"\n"
+""+"\n"
+"Select whether you shall connect to you opponent,or if you shall wait"+"\n"
+"him/her to connect to you.If you choose to connect you must enter"+"\n"
+"your opponents IP-address and make sure he/she has chosen to wait"+"\n"
+"for connection."+"\n"
+""+"\n"
+"If you're unable to connect,check your internet/network connection"+"\n"
+"and make sure you have enter a valid IP-address.",10,35);
JTextArea ta4=new JTextArea("Fyrad32"+"\n"+"Version 2.0,build 990523"+"\n"
+"Copyright 1999 Peter Sunna,Sweden"+"\n"
+""+"\n"
+"This program is freeware. If you,like it-pass it to your friends,can't"+"\n"
+"shop playing it-send me an e-mail,think it occupies too much disk"+"\n"
+"space-delete it."+"\n"
+""+"\n"
+"E-mail: peters@hem.passagen.se"+"\n"
+"Web Page: hem.passagen.se/peters/fyrad",10,35);
JTabbedPane tp=new JTabbedPane();//選項卡
ta1.setEditable(false);
ta2.setEditable(false);
ta3.setEditable(false);
ta4.setEditable(false);
p1.add(tp);
p2.add(ok);
tp.add("How To Play",ta1);
tp.add("Nomal Mode",ta2);
tp.add("Network Mode",ta3);
tp.add("About Fyrad",ta4);
tp.setTabPlacement(1);
ok.addActionListener(new ActionListener()
{public void actionPerformed(ActionEvent e){System.exit(0);}});
about.setTitle("About");
about.getContentPane().add(p1,"Center");
about.getContentPane().add(p2,"South");
about.setSize(415,290);
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
int ScreenWidth=screenSize.width;
int ScreenHeight=screenSize.height;
int x=(ScreenWidth-about.getWidth())/2;
int y=(ScreenHeight-about.getHeight())/2;
about.setLocation(x,y);
about.setVisible(true);
return about;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -