📄 zymodifysituation.java
字号:
package zhangyan34;
import java.awt.BorderLayout;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class zymodifysituation extends JFrame {
Hashtable info = null;
FileInputStream inOne = null;
ObjectInputStream inTwo = null;
FileOutputStream outOne = null;
ObjectOutputStream outTwo = null;
File file = null;
public zymodifysituation() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public zymodifysituation(File file) {
super("修改界面");
this.file = file;
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setSize(400, 300);
getContentPane().setLayout(null);
jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 18));
jLabel1.setText("输入要修改的信息");
jLabel1.setBounds(new Rectangle(12, 11, 159, 33));
jButton1.addActionListener(new zymodifysituation_jButton1_actionAdapter(this));
jButton2.addActionListener(new zymodifysituation_jButton2_actionAdapter(this));
jButton3.addActionListener(new zymodifysituation_jButton3_actionAdapter(this));
this.getContentPane().add(jLabel1);
jButton3.setBounds(new Rectangle(277, 288, 84, 43));
jButton3.setText("重置");
jButton2.setBounds(new Rectangle(277, 231, 78, 40));
jButton2.setEnabled(false);
jButton2.setText("修改");
jTextField5.setText("jTextField5");
jTextField5.setBounds(new Rectangle(101, 285, 132, 46));
jTextField4.setText("jTextField4");
jTextField4.setBounds(new Rectangle(101, 232, 131, 41));
jTextField3.setText("jTextField3");
jTextField3.setBounds(new Rectangle(100, 175, 130, 37));
jLabel8.setText("女");
jLabel8.setBounds(new Rectangle(287, 125, 60, 35));
jRadioButton2.setText("jRadioButton2");
jRadioButton2.setBounds(new Rectangle(223, 123, 46, 36));
jLabel7.setText("男");
jLabel7.setBounds(new Rectangle(147, 127, 47, 29));
jRadioButton1.setText("jRadioButton1");
jRadioButton1.setBounds(new Rectangle(101, 127, 29, 22));
jTextField2.setText("jTextField2");
jTextField2.setBounds(new Rectangle(99, 63, 130, 39));
jLabel6.setText("新出生");
jLabel6.setBounds(new Rectangle(14, 289, 57, 37));
jLabel5.setText("新班级");
jLabel5.setBounds(new Rectangle(18, 235, 85, 39));
jLabel4.setText("新专业");
jLabel4.setBounds(new Rectangle(15, 174, 92, 38));
jLabel3.setText("新性别");
jLabel3.setBounds(new Rectangle(16, 119, 92, 37));
jLabel2.setText("新姓名");
jLabel2.setBounds(new Rectangle(16, 63, 86, 33));
jButton1.setBounds(new Rectangle(313, 11, 80, 40));
jButton1.setText("开始修改");
this.getContentPane().add(jTextField1);
this.getContentPane().add(jButton1);
this.getContentPane().add(jTextField2);
this.getContentPane().add(jRadioButton1);
this.getContentPane().add(jLabel7);
this.getContentPane().add(jRadioButton2);
this.getContentPane().add(jLabel8);
this.getContentPane().add(jTextField3);
this.getContentPane().add(jTextField4);
this.getContentPane().add(jLabel5);
this.getContentPane().add(jLabel3);
this.getContentPane().add(jLabel4);
this.getContentPane().add(jLabel2);
this.getContentPane().add(jLabel6);
this.getContentPane().add(jTextField5);
this.getContentPane().add(jButton2);
this.getContentPane().add(jButton3);
jTextField1.setText("jTextField1");
jTextField1.setBounds(new Rectangle(164, 10, 135, 40));
}
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JButton jButton1 = new JButton();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JTextField jTextField2 = new JTextField();
JRadioButton jRadioButton1 = new JRadioButton();
JLabel jLabel7 = new JLabel();
JRadioButton jRadioButton2 = new JRadioButton();
JLabel jLabel8 = new JLabel();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
public void jButton3_actionPerformed(ActionEvent e) {
jTextField1.setText(null); // 使用setText(null)方法将学号文本框清空
jTextField2.setText(null); // 使用setText(null)方法将姓名文本框清空
jTextField3.setText(null); // 将专业文本框清空
jTextField4.setText(null); // 将年级文本框清空
jTextField5.setText(null); // 将出生文本框清空
}
public void jButton1_actionPerformed(ActionEvent e) {
String number = "";
number = jTextField1.getText();
if (number.length() > 0) {
try {
inOne = new FileInputStream(file);
inTwo = new ObjectInputStream(inOne);
info = (Hashtable) inTwo.readObject();
inOne.close();
inTwo.close();
} catch (Exception ee) {
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -