📄 serverset.java
字号:
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JTabbedPane;
import javax.swing.JButton;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.event.*;
import java.net.*;
public class ServerSet extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JButton jb_SavetoConfig = null;
private JButton jb_SaveOnce = null;
private JButton jb_Close = null;
private JTabbedPane jTabbedPane = null;
private JPanel jPanel1 = null;
private JPanel jPanel2 = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JTextField jt_Address = null;
private JButton jb_Test = null;
private JTextField jt_Port = null;
private JTextField jt_MaxCon = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JLabel jLabel6 = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JLabel jLabel9 = null;
private JTextField jt_DBUrl = null;
private JTextField jt_DBPort = null;
private JTextField jt_DBName = null;
private JTextField jt_DBUsername = null;
private JTextField jt_DBPassword = null;
private JLabel jLabel10 = null;
private JLabel jLabel11 = null;
private JLabel jLabel12 = null;
/**
* This is the default constructor
*/
public ServerSet() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(467, 324);
this.setContentPane(getJContentPane());
this.setTitle("服务端配置");
this.setAlwaysOnTop(true);
Function.setCenter(this);
this.setVisible(true);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJPanel(), BorderLayout.SOUTH);
jContentPane.add(getJTabbedPane(), BorderLayout.CENTER);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.insets = new Insets(5, 0, 5, 5);
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 2;
gridBagConstraints1.insets = new Insets(5, 5, 5, 0);
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
gridBagConstraints.gridy = 0;
jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jPanel.add(getJb_SavetoConfig(), gridBagConstraints2);
jPanel.add(getJb_SaveOnce(), gridBagConstraints);
jPanel.add(getJb_Close(), gridBagConstraints1);
}
return jPanel;
}
/**
* This method initializes jb_SavetoConfig
*
* @return javax.swing.JButton
*/
private JButton getJb_SavetoConfig() {
if (jb_SavetoConfig == null) {
jb_SavetoConfig = new JButton();
jb_SavetoConfig.setText("保存到配置文件");
jb_SavetoConfig.addActionListener(this);
}
return jb_SavetoConfig;
}
/**
* This method initializes jb_SaveOnce
*
* @return javax.swing.JButton
*/
private JButton getJb_SaveOnce() {
if (jb_SaveOnce == null) {
jb_SaveOnce = new JButton();
jb_SaveOnce.setText("仅对此次有效");
}
return jb_SaveOnce;
}
/**
* This method initializes jb_Close
*
* @return javax.swing.JButton
*/
private JButton getJb_Close() {
if (jb_Close == null) {
jb_Close = new JButton();
jb_Close.setText("关闭");
}
return jb_Close;
}
/**
* This method initializes jTabbedPane
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getJTabbedPane() {
if (jTabbedPane == null) {
jTabbedPane = new JTabbedPane();
jTabbedPane.setToolTipText("");
jTabbedPane.addTab("端口设置", null, getJPanel1(), null);
jTabbedPane.addTab("数据库设置", null, getJPanel2(), null);
jTabbedPane.setToolTipTextAt(1, "dfs");
}
return jTabbedPane;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 2;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 2;
jLabel4 = new JLabel();
jLabel4.setText("*默认最大连接数为1000");
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.gridx = 2;
gridBagConstraints10.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints10.gridy = 1;
jLabel3 = new JLabel();
jLabel3.setText("*不推荐小于1024");
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints9.gridy = 2;
gridBagConstraints9.weightx = 1.0;
gridBagConstraints9.insets = new Insets(5, 10, 5, 10);
gridBagConstraints9.gridx = 1;
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
gridBagConstraints8.fill = GridBagConstraints.BOTH;
gridBagConstraints8.gridy = 1;
gridBagConstraints8.weightx = 1.0;
gridBagConstraints8.insets = new Insets(5, 10, 5, 10);
gridBagConstraints8.gridx = 1;
GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
gridBagConstraints7.gridx = 2;
gridBagConstraints7.insets = new Insets(5, 0, 5, 60);
gridBagConstraints7.gridy = 0;
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.fill = GridBagConstraints.BOTH;
gridBagConstraints6.gridy = 0;
gridBagConstraints6.weightx = 1.0;
gridBagConstraints6.insets = new Insets(5, 10, 5, 10);
gridBagConstraints6.gridx = 1;
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.gridx = 0;
gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints5.insets = new Insets(0, 50, 0, 0);
gridBagConstraints5.gridy = 2;
jLabel2 = new JLabel();
jLabel2.setText("最大连接数:");
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints4.insets = new Insets(0, 50, 0, 0);
gridBagConstraints4.gridy = 1;
jLabel1 = new JLabel();
jLabel1.setText("监听端口:");
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.gridx = 0;
gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints3.insets = new Insets(0, 50, 0, 0);
gridBagConstraints3.gridy = 0;
jLabel = new JLabel();
jLabel.setText("服务器地址:");
jPanel1 = new JPanel();
jPanel1.setLayout(new GridBagLayout());
jPanel1.add(jLabel, gridBagConstraints3);
jPanel1.add(jLabel1, gridBagConstraints4);
jPanel1.add(jLabel2, gridBagConstraints5);
jPanel1.add(getJt_Address(), gridBagConstraints6);
jPanel1.add(getJb_Test(), gridBagConstraints7);
jPanel1.add(getJt_Port(), gridBagConstraints8);
jPanel1.add(getJt_MaxCon(), gridBagConstraints9);
jPanel1.add(jLabel3, gridBagConstraints10);
jPanel1.add(jLabel4, gridBagConstraints11);
}
return jPanel1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -