📄 chatserver_aboutbox.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class ChatServer_AboutBox extends JDialog implements ActionListener {
JPanel panel = new JPanel();
JPanel insetsPanel1 = new JPanel();
JPanel insetsPanel2 = new JPanel();
JButton button = new JButton();
JLabel label1 = new JLabel();
JLabel label2 = new JLabel();
JLabel label3 = new JLabel();
JLabel label4 = new JLabel();
JLabel label5 = new JLabel();
BorderLayout borderLayout = new BorderLayout();
FlowLayout flowLayout = new FlowLayout();
GridLayout gridLayout = new GridLayout();
String product = "聊天服务器端";
String version = "升级版";
String copyright = "1.0 Copyright (c) 2002 L.G.N. ";
String copyright1="2.0 Copyright (c) 2002 Z.Z.Q " ;
String comments = "本聊天服务器端实现了多线程客户连接和显示连接信息";
public ChatServer_AboutBox(Frame parent)
{
super(parent);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
pack();
}
/**Component initialization*/
private void jbInit() throws Exception
{
this.setTitle("About");
setResizable(false);
panel.setLayout(borderLayout);
insetsPanel1.setLayout(flowLayout);
gridLayout.setRows(4);
gridLayout.setColumns(1);
label1.setText(product);
label2.setText(version);
label3.setText(copyright);
label5.setText(copyright1);
label4.setText(comments);
insetsPanel2.setLayout(gridLayout);
insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30));
button.setText("Ok");
button.addActionListener(this);
this.getContentPane().add(panel, null);
insetsPanel2.add(label1, null);
insetsPanel2.add(label2, null);
insetsPanel2.add(label3, null);
insetsPanel2.add(label5, null);
insetsPanel2.add(label4, null);
insetsPanel1.add(button, null);
panel.add(insetsPanel1, BorderLayout.SOUTH);
panel.add(insetsPanel2, BorderLayout.NORTH);
insetsPanel1.setBackground(Color.orange);
insetsPanel2.setBackground(Color.orange);
}
/**Overridden so we can exit when window is closed*/
protected void processWindowEvent(WindowEvent e)
{
if (e.getID() == WindowEvent.WINDOW_CLOSING)
{
cancel();
}
super.processWindowEvent(e);
}
/**Close the dialog*/
void cancel()
{
dispose();
}
/**Close the dialog on a button event*/
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == button)
{
cancel();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -