package com.sdut.view;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import com.sdut.dao.StaffDao;
import com.sdut.model.Staff;
import com.sdut.util.DbUtil;
import com.sdut.util.StringUtil;
import javax.swing.border.TitledBorder;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class StaffUpdateFrm extends JFrame {
DbUtil dbUtil = new DbUtil();
StaffDao staffDao = new StaffDao();
private JPanel contentPane;
private JTextField staffUpdateTxt;
private JTable staffTable;
private JTextField numberTxt;
private JTextField staffNameTxt;
private JTextField sexTxt;
private JTextField ageTxt;
private JTextField departmentTxt;
private JTextField salaryTxt;
private JTextField dateTxt;
private JTextField remarksTxt;
/**
* Launch the application.
*/
/*public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
StaffUpdateFrm frame = new StaffUpdateFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}*/
/**
* Create the frame.
*/
public StaffUpdateFrm() {
setTitle("SDUT Software Professional Training");
setIconImage(Toolkit.getDefaultToolkit().getImage("image\\Main.png"));
//改变系统默认字体
Font font = new Font("Dialog", Font.PLAIN, 12);
java.util.Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource) {
UIManager.put(key, font);
}
}
//去掉最大化
setResizable(false);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 800, 600);
//居中显示
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("\u5458\u5DE5\u4FE1\u606F\u5220\u6539\u754C\u9762");
lblNewLabel.setBounds(304, 39, 210, 36);
lblNewLabel.setFont(new Font("微软雅黑", Font.BOLD, 25));
contentPane.add(lblNewLabel);
JLabel label = new JLabel("\u8BF7\u8F93\u5165\u5458\u5DE5\u5DE5\u53F7\uFF1A");
label.setBounds(165, 112, 103, 15);
contentPane.add(label);
staffUpdateTxt = new JTextField();
staffUpdateTxt.setBounds(304, 109, 210, 21);
contentPane.add(staffUpdateTxt);
staffUpdateTxt.setColumns(10);
staffTable = new JTable();
staffTable.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent arg0) {
int row = staffTable.getSelectedRow();
numberTxt.setText((String) staffTable.getValueAt(row, 0));
staffNameTxt.setText((String) staffTable.getValueAt(row, 1));
sexTxt.setText((String) staffTable.getValueAt(row, 2));
ageTxt.setText((String) staffTable.getValueAt(row, 3));
departmentTxt.setText((String) staffTable.getValueAt(row, 4));
salaryTxt.setText((String) staffTable.getValueAt(row, 5));
dateTxt.setText((String) staffTable.getValueAt(row, 6));
remarksTxt.setText((String) staffTable.getValueAt(row, 7));
}
});
staffTable.setBounds(1, 27, 663, 0);
staffTable.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"\u5458\u5DE5\u5DE5\u53F7", "\u5458\u5DE5\u59D3\u540D", "\u5458\u5DE5\u6027\u522B", "\u5458\u5DE5\u5E74\u9F84", "\u6240\u5C5E\u90E8\u95E8", "\u5458\u5DE5\u85AA\u8D44", "\u5165\u804C\u65E5\u671F", "\u5907\u6CE8"
}
));
staffTable.getColumnModel().getColumn(0).setPreferredWidth(82);
staffTable.getColumnModel().getColumn(1).setPreferredWidth(62);
staffTable.getColumnModel().getColumn(2).setPreferredWidth(62);
staffTable.getColumnModel().getColumn(3).setPreferredWidth(62);
staffTable.getColumnModel().getColumn(7).setPreferredWidth(112);
contentPane.add(staffTable);
try {
this.fillTable(new Staff());
} catch (Exception e) {
e.printStackTrace();
}
JButton staffQueryButton = new JButton("\u67E5\u8BE2");
staffQueryButton.setBounds(567, 108, 93, 23);
staffQueryButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String staffQuerykey = staffUpdateTxt.getText();
Staff staff = new Staff();
staff.setNumber(staffQuerykey);
try {
fillTable(staff);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
contentPane.add(staffQueryButton);
JScrollPane scrollPane = new JScrollPane(staffTable);
scrollPane.setBounds(62, 163, 665, 159);
contentPane.add(scrollPane);
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(null, "\u8BF7\u5728\u6B64\u5904\u5220\u9664\u4FEE\u6539\u5458\u5DE5\u4FE1\u606F", TitledBorder.LEADING, TitledBorder.TOP, null, null));
panel.setToolTipText("");
panel.setBounds(62, 344, 665, 217);
contentPane.add(panel);
panel.setLayout(null);
JLabel label_1 = new JLabel("\u5458\u5DE5\u5DE5\u53F7\uFF1A");
label_1.setBounds(50, 32, 68, 15);
panel.add(label_1);
numberTxt = new JTextField();
numberTxt.setBounds(128, 29, 138, 21);
panel.add(numberTxt);
numberTxt.setColumns(10);
JLabel label_2 = new JLabel("\u5458\u5DE5\u59D3\u540D\uFF1A");
label_2.setBounds(299, 32, 68, 15);
panel.add(label_2);
staffNameTxt = new JTextField();
staffNameTxt.setBounds(373, 29, 138, 21);
panel.add(staffNameTxt);
staffNameTxt.setColumns(10);
JLabel label_3 = new JLabel("\u5458\u5DE5\u6027\u522B\uFF1A");
label_3.setBounds(50, 75, 68, 15);
panel.add(label_3);
sexTxt = new JTextField();
sexTxt.setBounds(128, 72, 138, 21);
panel.add(sexTxt);
sexTxt.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("\u5458\u5DE5\u5E74\u9F84\uFF1A");
lblNewLabel_1.setBounds(299, 75, 65, 15);
panel.add(lblNewLabel_1);
ageTxt = new JTextField();
ageTxt.setBounds(373, 72, 138, 21);
panel.add(ageTxt);
ageTxt.setColumns(10);
JLabel label_4 = new JLabel("\u6240\u5C5E\u90E8\u95E8\uFF1A");
label_4.setBounds(50, 119, 68, 15);
panel.add(label_4);
departmentTxt = new JTextField();
departmentTxt.setBounds(128, 116, 138, 21);
panel.add(departmentTxt);
departmentTxt.setColumns(10);
JLabel label_5 = new JLabel("\u5458\u5DE5\u85AA\u8D44\uFF1A");
label_5.setBounds(299, 119, 68, 15);
panel.add(label_5);
salaryTxt = new JTextField();
salaryTxt.setBounds(373, 116, 80, 21);
panel.add(salaryTxt);
salaryTxt.setColumns(10);
JLabel label_6 = new JLabel("\u4E07\u5143/\u5E74");
label_6.setBounds(463, 119, 54, 15);
panel.add(label_6);
JLabel label_7 = new JLabel("\u5165\u804C\u65E5\u671F\uFF1A");
label_7.setBounds(50, 164, 68, 15);
panel.add(label_7);
dateTxt = new JTextField();
dateTxt.setBounds(128, 161, 138, 21);
panel.add(dateTxt);
dateTxt.setColumns(10);
JLabel label_8 = new JLabel("\u5907 \u6CE8\uFF1A");
label_8.setBounds(299, 164, 94, 15);
panel.add(label_8);
remarksTxt = new JTextField();
remarksTxt.setBounds(373, 161, 138, 21);
panel.add(remarksTxt);
remarksTxt.setColumns(10);
JButton updateButton = new JButton("\u4FEE\u6539");
updateButton.addActionListener(new ActionListener() {
qq_33404596
- 粉丝: 88
- 资源: 728
最新资源
- 基于51单片机与12864无字库液晶的贪吃蛇程序设计源码
- 炫光舞蹈特效-Saber插件的高能应用教程
- 基于matlab的扩展卡尔曼滤波(Extended Kalman Filter,EKF),通过卡尔曼滤波算法近似计算系统的状态估计值和方差估计值,对信号进行滤波 程序已调通,可直接运行 程序保证
- 基于Next.js的Tsx语言驱动的刷题题库系统设计源码
- 基于Ejs框架的英语学习后台源码设计
- PF GNN机器学习预测裂缝扩展
- 路面附着系数估计,采用UKF和EKF两种算法 软件为Matlab Simulink,非Carsim联合仿真 dugoff轮胎模块:纯simulink搭非代码 整车模块:7自由度整车模型 估计模块:
- 基于Yii2+Vue2.0+uniapp的多端易用开店星公众版设计源码
- 三相整流电路;VOC控制;Simulink仿真 三相整流;三相整流器;三相整流转器; 输入交流380V,输出600V直流 输出可按需求更改
- 基于分布式、前后端分离的Chaos设计源码,支持多框架快速开发架构
- 基于Java语言的EcgLineView心电图与折线图自定义View设计源码
- abb机器人视觉引导抓取C#联合halcon联合RobotStudio实现仿真九点标定海康工业相机C#上位机视觉抓取 -本链接只出源码+工作站,不出任何硬件,工业相机请自备 -提供2个版本一个是有海康
- 基于PHP开发的WordPress WebStack导航主题源码下载
- 基于PHP、Bootstrap和MySQL的农产品溯源管理系统设计源码
- 基于Kotlin语言的AppMonitor设计源码,轻松监控App状态变化
- plecs三相并网逆变器序阻抗扫频程序 plecs联合matlab进行扫频 阻抗扫描 电力电子 弱电网 稳定性分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈