📄 main.java
字号:
/*
* Main.java
*
* Created on 2007年7月28日, 上午11:02
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package 第一个swing程序;
import java.awt.*;
import javax.swing.*;
class FirstSwing extends JFrame
{private JLabel jLabelUserName;
private JLabel jLabelPassword;
private JTextField jTextFieldUserName;
private JPasswordField jpfPassword;
private JButton jButtonEnter;
private JButton jButtonCancel;
public FirstSwing()
{
this.setLayout(null);
jLabelUserName=new JLabel("用户名:");
jLabelPassword=new JLabel("密码:");
jTextFieldUserName=new JTextField();
jpfPassword=new JPasswordField();
jButtonEnter=new JButton("确定");
jButtonCancel=new JButton("取消");
jLabelUserName.setBounds(10,20,80,20);
jLabelPassword.setBounds(10,50,80,20);
jTextFieldUserName.setBounds(100,20,150,20);
jpfPassword.setBounds(100,50,150,20);
jButtonEnter.setBounds(80,90,60,20);
jButtonCancel.setBounds(160,90,60,20);
this.add(jLabelUserName);
this.add(jLabelPassword);
this.add(jTextFieldUserName);
this.add(jpfPassword);
this.add(jButtonEnter);
this.add(jButtonCancel);
this.setBounds(330,250,300,150);
this.setTitle("这是第一个Swing程序!");
this.setVisible(true);
}
}
/**
*
* @author Administrator
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
FirstSwing mySwing=new FirstSwing();
// TODO code application logic here
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -