📄 searchteacherui.java
字号:
package view;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
//教师窗口 对教师信息修改与删除
public class searchteacherUI extends JFrame {
private JTable tablesteacher;
private JComboBox cbtkecheng;
private JComboBox cbtstatus;
private JTextField tftage;
private ButtonGroup tsex = new ButtonGroup();
private JTextField tftname;
private JTextField tftyear;
public searchteacherUI() {
super();
setTitle("不晕校园管理系统->教师修改");
getContentPane().setLayout(null);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //关闭方式
this.setSize(845,280);
this.setVisible(true);//显示窗口
final JPanel ttiaojianpanel = new JPanel();
ttiaojianpanel.setBorder(new TitledBorder(null, "教师查询条件", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
ttiaojianpanel.setLayout(null);
ttiaojianpanel.setBounds(10, 10, 330, 225);
getContentPane().add(ttiaojianpanel);
final JCheckBox checkBox = new JCheckBox();
checkBox.setBounds(10, 23, 49, 23);
ttiaojianpanel.add(checkBox);
checkBox.setText("使用");
final JCheckBox checkBox_1 = new JCheckBox();
checkBox_1.setBounds(10, 48, 49, 23);
ttiaojianpanel.add(checkBox_1);
checkBox_1.setText("使用");
final JCheckBox checkBox_2 = new JCheckBox();
checkBox_2.setBounds(10, 70, 49, 23);
ttiaojianpanel.add(checkBox_2);
checkBox_2.setText("使用");
final JCheckBox checkBox_3 = new JCheckBox();
checkBox_3.setBounds(10, 95, 49, 23);
ttiaojianpanel.add(checkBox_3);
checkBox_3.setText("使用");
final JCheckBox checkBox_4 = new JCheckBox();
checkBox_4.setBounds(10, 119, 49, 23);
ttiaojianpanel.add(checkBox_4);
checkBox_4.setText("使用");
final JCheckBox checkBox_5 = new JCheckBox();
checkBox_5.setBounds(10, 145, 49, 23);
ttiaojianpanel.add(checkBox_5);
checkBox_5.setText("使用");
final JLabel label_4_1_2_1 = new JLabel();
label_4_1_2_1.setBounds(65, 147, 66, 18);
ttiaojianpanel.add(label_4_1_2_1);
label_4_1_2_1.setText("教师状态:");
final JLabel label_4_1_2_1_1 = new JLabel();
label_4_1_2_1_1.setBounds(65, 121, 66, 18);
ttiaojianpanel.add(label_4_1_2_1_1);
label_4_1_2_1_1.setText("教师课程:");
final JLabel label_6 = new JLabel();
label_6.setBounds(65, 97, 66, 18);
ttiaojianpanel.add(label_6);
label_6.setText("入职日期:");
final JLabel label_4 = new JLabel();
label_4.setBounds(65, 72, 66, 18);
ttiaojianpanel.add(label_4);
label_4.setText("教师年龄:");
final JLabel label_1 = new JLabel();
label_1.setBounds(65, 50, 66, 18);
ttiaojianpanel.add(label_1);
label_1.setText("教师性别:");
final JLabel label = new JLabel();
label.setBounds(65, 25, 66, 18);
ttiaojianpanel.add(label);
label.setText("教师姓名:");
tftname = new JTextField();
tftname.setBounds(132, 25, 81, 22);
ttiaojianpanel.add(tftname);
final JRadioButton man = new JRadioButton();
man.setBounds(132, 53, 39, 18);
ttiaojianpanel.add(man);
man.setSelected(true);
tsex.add(man);
man.setText("男");
final JRadioButton woman = new JRadioButton();
woman.setBounds(170, 53, 55, 18);
ttiaojianpanel.add(woman);
tsex.add(woman);
woman.setText("女");
tftage = new JTextField();
tftage.setBounds(132, 70, 81, 22);
ttiaojianpanel.add(tftage);
final JLabel label_1_1 = new JLabel();
label_1_1.setBounds(225, 75, 27, 18);
ttiaojianpanel.add(label_1_1);
label_1_1.setText("岁");
tftyear = new JTextField();
tftyear.setBounds(132, 95, 39, 22);
ttiaojianpanel.add(tftyear);
final JLabel label_7 = new JLabel();
label_7.setBounds(175, 95, 13, 18);
ttiaojianpanel.add(label_7);
label_7.setText("年");
cbtkecheng = new JComboBox(); //教师所教课程
cbtkecheng.setBounds(132, 121, 163, 22);
ttiaojianpanel.add(cbtkecheng);
cbtkecheng.setSelectedIndex(1);
cbtstatus = new JComboBox();//教师状态下拉列表
cbtstatus.setBounds(132, 147, 163, 22);
ttiaojianpanel.add(cbtstatus);
cbtstatus.setModel(new DefaultComboBoxModel(new String[] {"在职", "休假", "退休"}));
cbtstatus.setSelectedIndex(1);
final JButton btsearcht = new JButton();
btsearcht.setBounds(65, 175, 66, 28);
ttiaojianpanel.add(btsearcht);
btsearcht.setText("查询");
final JButton btmodifyteacher = new JButton();
btmodifyteacher.setBounds(147, 175, 66, 28);
ttiaojianpanel.add(btmodifyteacher);
btmodifyteacher.setText("修改");
final JButton btexit = new JButton();
btexit.setBounds(229, 175, 66, 28);
ttiaojianpanel.add(btexit);
btexit.setText("退出");
final JPanel tjieguopanel = new JPanel();
tjieguopanel.setLayout(null);
tjieguopanel.setBorder(new TitledBorder(null, "查询结果", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, null, null));
tjieguopanel.setBounds(352, 10, 471, 225);
getContentPane().add(tjieguopanel);
final JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(10, 23, 454, 192);
tjieguopanel.add(scrollPane);
tablesteacher = new JTable();
scrollPane.setViewportView(tablesteacher);
}
public static void main(String[] args) {
new searchteacherUI();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -