?? help.java
字號:
import java.awt.*;
import javax.swing.border.*;
import java.net.*;
import javax.swing.*;
import java.awt.event.*;
/**
* 生成設(shè)置對話框的類
*/
public class Help extends JDialog {
JPanel titlePanel = new JPanel();
JPanel contentPanel = new JPanel();
JPanel closePanel = new JPanel();
JButton close = new JButton();
JLabel title = new JLabel("聊天室客戶端幫助");
JTextArea help = new JTextArea();
Color bg = new Color(255,255,255);
public Help(JFrame frame) {
super(frame, true);
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
//設(shè)置運(yùn)行位置,使對話框居中
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 + 25,
(int) (screenSize.height - 320) / 2);
this.setResizable(false);
}
private void jbInit() throws Exception {
this.setSize(new Dimension(350, 270));
this.setTitle("幫助");
titlePanel.setBackground(bg);;
contentPanel.setBackground(bg);
closePanel.setBackground(bg);
help.setText("1、設(shè)置所要連接服務(wù)端的IP地址和端口"+
"(默認(rèn)設(shè)置為\n 127.0.0.1:8888)。\n"+
"2、輸入你的用戶名(默認(rèn)設(shè)置為:匆匆過客)。\n"+
"3、點(diǎn)擊“登錄”便可以連接到指定的服務(wù)器;\n"+
" 點(diǎn)擊“注銷”可以和服務(wù)器端開連接。\n"+
"4、選擇需要接受消息的用戶,在消息欄中寫入消息,\n"+
" 同時選擇表情,之后便可發(fā)送消息。\n");
help.setEditable(false);
titlePanel.add(new Label(" "));
titlePanel.add(title);
titlePanel.add(new Label(" "));
contentPanel.add(help);
closePanel.add(new Label(" "));
closePanel.add(close);
closePanel.add(new Label(" "));
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(titlePanel, BorderLayout.NORTH);
contentPane.add(contentPanel, BorderLayout.CENTER);
contentPane.add(closePanel, BorderLayout.SOUTH);
close.setText("關(guān)閉");
//事件處理
close.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
}
);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -