📄 kuframe.java~39~
字号:
package Frame;
import javax.swing.*;
import java.awt.Toolkit;
import java.awt.Dimension;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class KuFrame extends JFrame {
public KuFrame() {
super();
this.getContentPane().setLayout(null);
setSize(_width,_height);
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension dim=kit.getScreenSize();
setLocation(dim.width/2-_width/2,dim.height/2-_height/2);
setVisible(true);
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private int _width=350;
private int _height=200;
private JLabel IPLab=new JLabel("输入服务器IP:");
private JLabel UserNameLab=new JLabel("输入您的名字:");
private JTextArea IPText=new javax.swing.JTextArea("");
private JTextArea UserNameText=new JTextArea("");
private JButton TestButton=new JButton("测 试");
private JButton OkButton=new JButton("确 定");
private JButton ExitButton=new JButton("退 出");
public static void main(String[] args) {
KuFrame kuframe = new KuFrame();
}
private void jbInit() throws Exception {
IPLab.setBounds(3,10,100,20);
IPLab.setVisible(true);
this.getContentPane().add(IPLab);
IPText.setBounds(103,10,120,20);
IPText.setVisible(true);
this.getContentPane().add(IPText);
UserNameLab.setBounds(3,35,100,20);
UserNameLab.setVisible(true);
this.getContentPane().add(UserNameLab);
UserNameText.setBounds(103,35,120,20);
UserNameText.setVisible(true);
this.getContentPane().add(UserNameText);
TestButton.setBounds(240,10,70,20);
TestButton.setVisible(true);
this.getContentPane().add(TestButton);
OkButton.setBounds(40,70,70,20);
OkButton.setVisible(true);
this.getContentPane().add(OkButton);
ExitButton.setBounds(180,70,70,20);
ExitButton.setVisible(true);
this.getContentPane().add(ExitButton);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -