📄 frame1.java
字号:
package sfms;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;public class Frame1 extends JFrame { JPanel contentPane; XYLayout xYLayout1 = new XYLayout(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JTextField jTextField1 = new JTextField(); JTextField jTextField2 = new JTextField(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); //Construct the frame public Frame1() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); jLabel1.setFont(new java.awt.Font("Dialog", 1, 18)); jLabel1.setForeground(new Color(255, 144, 85)); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText("欢迎进入学生信息管理系统"); contentPane.setLayout(xYLayout1); this.setSize(new Dimension(400, 300)); this.setTitle("简易学生信息管理系统 SFMS"); jLabel2.setFont(new java.awt.Font("Dialog", 1, 15)); jLabel2.setForeground(Color.blue); jLabel2.setText("用户名"); jLabel3.setFont(new java.awt.Font("Dialog", 1, 15)); jLabel3.setForeground(Color.blue); jLabel3.setText("密码"); jTextField1.setText(""); jTextField2.setText(""); jButton1.setFont(new java.awt.Font("Dialog", 1, 15)); jButton1.setForeground(Color.blue); jButton1.setText("提 交"); jButton2.setFont(new java.awt.Font("Dialog", 1, 15)); jButton2.setForeground(Color.blue); jButton2.setText("清 除"); jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this)); contentPane.add(jLabel1, new XYConstraints(7, 0, 380, 40)); contentPane.add(jLabel2, new XYConstraints(47, 87, 94, 31)); contentPane.add(jLabel3, new XYConstraints(46, 165, 93, 32)); contentPane.add(jTextField1, new XYConstraints(180, 88, 130, 32)); contentPane.add(jTextField2, new XYConstraints(180, 162, 131, 32)); contentPane.add(jButton1, new XYConstraints(67, 237, 92, 32)); contentPane.add(jButton2, new XYConstraints(244, 237, 92, 32)); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jButton2_actionPerformed(ActionEvent e) { jTextField1.setText(""); jTextField2.setText(""); }}class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener { Frame1 adaptee; Frame1_jButton2_actionAdapter(Frame1 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -