?? 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("聊天室服務(wù)端幫助");
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,
(int) (screenSize.height - 320) / 2);
this.setResizable(false);
}
private void jbInit() throws Exception {
this.setSize(new Dimension(400, 200));
this.setTitle("幫助");
titlePanel.setBackground(bg);;
contentPanel.setBackground(bg);
closePanel.setBackground(bg);
help.setText("1、設(shè)置服務(wù)端的偵聽端口(默認(rèn)端口為8888)。\n"+
"2、點(diǎn)擊 啟動服務(wù) 按鈕便可在指定的端口啟動服務(wù)。\n"+
"3、選擇需要接受消息的用戶,在消息欄中寫入消息,之后便可發(fā)送消息。\n"+
"4、信息狀態(tài)欄中顯示服務(wù)器當(dāng)前的啟動與停止?fàn)顟B(tài)、"+
"用戶發(fā)送的消息和\n 服務(wù)器端發(fā)送的系統(tǒng)消息。");
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 + -