📄 new_student_dialog.java
字号:
package student;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class New_Student_Dialog extends JDialog { JPanel panel1 = new JPanel(); XYLayout xYLayout1 = new XYLayout(); JLabel jLabel1 = new JLabel(); JTextField jTextField1 = new JTextField(); JLabel jLabel2 = new JLabel(); JTextField jTextField2 = new JTextField(); JPanel jPanel1 = new JPanel(); XYLayout xYLayout2 = new XYLayout(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); boolean isOK = true; public New_Student_Dialog(Frame frame, String title, boolean modal) { super(frame, title, modal); try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public New_Student_Dialog() { this(null, "", false); } private void jbInit() throws Exception { panel1.setLayout(xYLayout1); jLabel1.setFont(new java.awt.Font("DialogInput", 0, 12)); jLabel1.setText("学号:"); jTextField1.setText(""); jLabel2.setText("姓名:"); jLabel2.setFont(new java.awt.Font("DialogInput", 0, 12)); jTextField2.setText(""); jPanel1.setBorder(BorderFactory.createEtchedBorder()); jPanel1.setLayout(xYLayout2); this.setResizable(false); this.setTitle("录入"); jButton1.setFont(new java.awt.Font("DialogInput", 0, 12)); jButton1.setText("确定"); jButton1.addActionListener(new New_Student_Dialog_jButton1_actionAdapter(this)); jButton2.setText("取消"); jButton2.addActionListener(new New_Student_Dialog_jButton2_actionAdapter(this)); jButton2.setFont(new java.awt.Font("DialogInput", 0, 12)); getContentPane().add(panel1); panel1.add(jPanel1, new XYConstraints(12, 14, 231, 153)); jPanel1.add(jLabel1, new XYConstraints(29, 31, -1, -1)); jPanel1.add(jTextField2, new XYConstraints(94, 64, 108, -1)); jPanel1.add(jTextField1, new XYConstraints(94, 28, 108, -1)); jPanel1.add(jLabel2, new XYConstraints(29, 67, -1, -1)); jPanel1.add(jButton1, new XYConstraints(25, 107, -1, -1)); jPanel1.add(jButton2, new XYConstraints(143, 107, -1, -1)); } void jButton2_actionPerformed(ActionEvent e) { isOK=false; this.dispose(); } void jButton1_actionPerformed(ActionEvent e) { if(jTextField1.getText().length()==0) { JOptionPane.showMessageDialog(this,"请输入学号"); return; } if(jTextField2.getText().length()==0) { JOptionPane.showMessageDialog(this,"请输入姓名"); return; } isOK=true; this.hide(); }}class New_Student_Dialog_jButton2_actionAdapter implements java.awt.event.ActionListener { New_Student_Dialog adaptee; New_Student_Dialog_jButton2_actionAdapter(New_Student_Dialog adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton2_actionPerformed(e); }}class New_Student_Dialog_jButton1_actionAdapter implements java.awt.event.ActionListener { New_Student_Dialog adaptee; New_Student_Dialog_jButton1_actionAdapter(New_Student_Dialog adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -