📄 frame1.java~5~
字号:
package loginexample;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPasswordField;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame1 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JPasswordField jPasswordField1 = new JPasswordField();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setSize(new Dimension(358, 221));
setTitle("Frame Title");
jLabel1.setText("用户名:");
jLabel1.setBounds(new Rectangle(42, 41, 88, 27));
jLabel2.setText("密 码:");
jLabel2.setBounds(new Rectangle(41, 73, 93, 20));
jTextField1.setBounds(new Rectangle(181, 38, 102, 21));
jButton1.setBounds(new Rectangle(31, 106, 113, 25));
jButton1.setMnemonic('A');
jButton1.setText("确定(A)");
jButton2.setBounds(new Rectangle(168, 108, 116, 25));
jButton2.setMnemonic('C');
jButton2.setText("取消(C)");
jPasswordField1.setBounds(new Rectangle(181, 76, 102, 21));
contentPane.add(jLabel1);
contentPane.add(jLabel2);
contentPane.add(jButton1);
contentPane.add(jTextField1);
contentPane.add(jPasswordField1);
contentPane.add(jButton2);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -