目录
一、系统介绍
1.开发环境
2.技术选型
3.系统功能
4.数据库
二、系统展示
1.登录系统
2.用户-登录系统
3.用户-查看工资
4.管理员-主界面
5.管理员-添加员工信息
6.管理员-修改员工信息
7.管理员-洗掉员工信息
8.管理员-添加部门信息
9.管理员-修改部门信息
10.管理员-洗掉部门信息
11.管理员-工资设定
12.管理员-工资查询
13.管理员-工资一览
三、部分代码
Login.java
MainFrame.java
DBConn.java
AddDepartment.java
AddEmployee.java
四、其他
1.更多系统
JavaSwing系统系列实作
Java+JSP系统系列实作
Java+Servlet系统系列实作
Java+SSM系统系列实作
Java+SSH系统系列实作
Java+Springboot系统系列实作
2.原始码下载
3.运行项目
4.备注
5.支持博主
一、系统介绍
1.开发环境
开发工具:Eclipse2021
JDK版本:jdk1.8
Mysql版本:8.0.13
2.技术选型
Java+Swing+Mysql
3.系统功能
1.用户匿名登录系统,查询工资信息;
2.管理员登录登出系统;
3.管理员增加员工信息,修改员工信息,洗掉员工信息;
3.管理员增加部门信息,修改部门信息,洗掉部门信息;
4.管理员查询员工工资,添加员工工资;
4.数据库
/*
Navicat Premium Data Transfer
Source Server : MySQL
Source Server Type : MySQL
Source Server Version : 80013
Source Host : 127.0.0.1:3306
Source Schema : swing_salary_management
Target Server Type : MySQL
Target Server Version : 80013
File Encoding : 65001
Date: 23/12/2021 21:19:54
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for department
-- ----------------------------
DROP TABLE IF EXISTS `department`;
CREATE TABLE `department` (
`ID` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`Name` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`Director` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`Number` int(16) NOT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of department
-- ----------------------------
INSERT INTO `department` VALUES ('ks001', '经理室', '赢政', 10);
INSERT INTO `department` VALUES ('ks002', '财务室', '刘邦', 6);
INSERT INTO `department` VALUES ('ks003', '军机部', '李鸿章', 6);
INSERT INTO `department` VALUES ('ks004', '外交部', '张仪', 8);
INSERT INTO `department` VALUES ('ks005', '技术科', '朱元璋', 10);
INSERT INTO `department` VALUES ('ks006', '董事会', '李世民', 10);
-- ----------------------------
-- Table structure for employee
-- ----------------------------
DROP TABLE IF EXISTS `employee`;
CREATE TABLE `employee` (
`ID` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`sex` char(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`age` int(6) NOT NULL,
`department` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`position` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`phone` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
`time` datetime(0) NULL DEFAULT NULL,
`address` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of employee
-- ----------------------------
INSERT INTO `employee` VALUES ('0001', '赢政', '男', 37, '经理室', '经理', '10086', '0201-01-01 00:00:00', '咸阳');
INSERT INTO `employee` VALUES ('0002', '刘邦', '男', 40, '技术科', '技术长', '10087910', '2001-05-06 00:00:00', '长安');
INSERT INTO `employee` VALUES ('0003', '武则天', '女', 30, '财务室', '经理', '10088', '1999-08-07 00:00:00', '长安');
INSERT INTO `employee` VALUES ('0004', '刘秀', '男', 46, '军机部', '副部长', '123548788', '2013-05-07 00:00:00', '桂林');
INSERT INTO `employee` VALUES ('0005', '西施', '女', 23, '财务室', '会计', '10089', '2001-02-03 00:00:00', '越国');
INSERT INTO `employee` VALUES ('0006', '李清照', '女', 25, '财务室', '出纳', '125478', '2012-03-04 00:00:00', '宋国');
INSERT INTO `employee` VALUES ('0007', '杨玉环', '女', 29, '财务室', '会计', '125478', '2010-02-04 00:00:00', '长安');
INSERT INTO `employee` VALUES ('0008', '孙权', '男', 35, '外交部', '部长', '150478', '2005-05-04 00:00:00', '江东');
INSERT INTO `employee` VALUES ('0009', '李世民', '男', 54, '董事会', '会长', '100865', '1998-05-08 00:00:00', '西安');
INSERT INTO `employee` VALUES ('0010', '项羽', '男', 40, '经理室', '副经理', '1008670', '2000-02-05 00:00:00', '彭城');
INSERT INTO `employee` VALUES ('0011', '李鸿章', '男', 52, '军机部', '部长', '1008699', '2001-05-08 00:00:00', '北京');
INSERT INTO `employee` VALUES ('0012', '张仪', '男', 44, '外交部', '部长', '10089', '2002-02-04 00:00:00', '魏国');
INSERT INTO `employee` VALUES ('0013', '朱元璋', '男', 35, '技术科', '部长', '100896', '2013-05-07 00:00:00', '南京');
INSERT INTO `employee` VALUES ('0014', '貂蝉', '女', 25, '经理室', '助理', '10086972', '2005-05-04 00:00:00', '洛阳');
INSERT INTO `employee` VALUES ('0015', '李渊', '男', 55, '董事会', '董事', '25897', '2001-02-05 00:00:00', '长安');
INSERT INTO `employee` VALUES ('0016', '1', '男', 1, '经理室', '1', '1', '2001-02-05 00:00:00', '2');
-- ----------------------------
-- Table structure for salary
-- ----------------------------
DROP TABLE IF EXISTS `salary`;
CREATE TABLE `salary` (
`salaryID` int(4) NOT NULL AUTO_INCREMENT,
`ID` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
`basepay` int(10) NULL DEFAULT NULL,
`welfare` int(10) NULL DEFAULT NULL,
`reward` int(10) NULL DEFAULT NULL,
`insurance` int(10) NULL DEFAULT NULL,
`funds` int(10) NULL DEFAULT NULL,
`month` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`remark` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`salaryID`, `ID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of salary
-- ----------------------------
INSERT INTO `salary` VALUES (1, '0001', '赢政', 3000, 100, 100, 100, 500, '1月', '未结算');
INSERT INTO `salary` VALUES (13, '0002', '刘邦', 3000, 200, 100, 100, 400, '1月', '未结算');
INSERT INTO `salary` VALUES (15, '0003', '武则天', 2500, 100, 200, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (16, '0004', '刘秀', 2900, 100, 150, 250, 200, '1月', '未结算');
INSERT INTO `salary` VALUES (17, '0005', '西施', 2800, 100, 100, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (18, '0006', '李清照', 2700, 120, 150, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (19, '0007', '杨玉环', 2680, 200, 150, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (20, '0008', '孙权', 2900, 100, 200, 100, 500, '1月', '未结算');
INSERT INTO `salary` VALUES (21, '0009', '李世民', 2870, 200, 100, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (22, '0010', '项羽', 2600, 200, 100, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (23, '0011', '李鸿章', 2800, 200, 100, 100, 300, '1月', '未结算');
INSERT INTO `salary` VALUES (24, '0012', '张仪', 2900, 200, 150, 100, 500, '1月', '未结算');
INSERT INTO `salary` VALUES (25, '0013', '朱元璋', 2600, 250, 200, 100, 400, '1月', '未结算');
INSERT INTO `salary` VALUES (26, '0001', '赢政', 3000, 100, 200, 100, 300, '2月', '未结算');
INSERT INTO `salary` VALUES (27, '0001', '赢政', 3000, 250, 200, 100, 400, '3月', '未结算');
INSERT INTO `salary` VALUES (28, '0002', '刘邦', 3000, 250, 150, 100, 400, '2月', '未结算');
INSERT INTO `salary` VALUES (29, '0002', '刘邦', 3000, 300, 150, 100, 500, '3月', '未结算');
INSERT INTO `salary` VALUES (30, '0003', '武则天', 2900, 200, 150, 100, 300, '2月', '未结算');
INSERT INTO `salary` VALUES (31, '0003', '武则天', 2800, 250, 120, 100, 500, '3月', '未结算');
INSERT INTO `salary` VALUES (33, '0004', '刘秀', 2580, 500, 200, 100, 300, '2月', '未结算');
INSERT INTO `salary` VALUES (35, '0004', '刘秀', 2900, 200, 150, 100, 300, '3月', '未结算');
INSERT INTO `salary` VALUES (37, '0005', '西施', 2900, 200, 100, 100, 300, '2月', '未结算');
INSERT INTO `salary` VALUES (39, '0005', '西施', 2800, 200, 150, 100, 300, '3月', '未结算');
INSERT INTO `salary` VALUES (40, '0006', '李清照', 2900, 200, 100, 100, 300, '2月', '未结算');
INSERT INTO `salary` VALUES (41, '0006', '李清照', 2900, 200, 100, 100, 300, '3月', '未结算');
-- ----------------------------
-- Table structure for userlist
-- ----------------------------
DROP TABLE IF EXISTS `userlist`;
CREATE TABLE `userlist` (
`status` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`username`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of userlist
-- ----------------------------
INSERT INTO `userlist` VALUES ('管理员', 'admin', 'admin');
-- ----------------------------
-- Table structure for view_salary
-- ----------------------------
DROP TABLE IF EXISTS `view_salary`;
CREATE TABLE `view_salary` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`工号` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`姓名` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
`部门` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
`职位` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL,
`总工资` int(10) NULL DEFAULT NULL,
`月份` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`备注` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of view_salary
-- ----------------------------
INSERT INTO `view_salary` VALUES (1, '0001', '赢政', '经理室', '经理', 2600, '1月', '未结算');
INSERT INTO `view_salary` VALUES (9, '0002', '刘邦', '技术室', '技术长', 2800, '1月', '未结算');
INSERT INTO `view_salary` VALUES (11, '0003', '武则天', '财务室', '经理', 2400, '1月', '未结算');
INSERT INTO `view_salary` VALUES (12, '0004', '刘秀', '军机部', '大王', 2700, '1月', '未结算');
INSERT INTO `view_salary` VALUES (13, '0005', '西施', '财务室', '会计', 2600, '1月', '未结算');
INSERT INTO `view_salary` VALUES (14, '0006', '李清照', '财务室', '出纳', 2570, '1月', '未结算');
INSERT INTO `view_salary` VALUES (15, '0007', '杨玉环', '财务室', '会计', 2630, '1月', '未结算');
INSERT INTO `view_salary` VALUES (16, '0008', '孙权', '外交部', '部长', 2600, '1月', '未结算');
INSERT INTO `view_salary` VALUES (17, '0009', '李世民', '董事会', '会长', 2770, '1月', '未结算');
INSERT INTO `view_salary` VALUES (18, '0010', '项羽', '经理室', '副经理', 2500, '1月', '未结算');
INSERT INTO `view_salary` VALUES (19, '0011', '李鸿章', '军机部', '部长', 2700, '1月', '未结算');
INSERT INTO `view_salary` VALUES (20, '0012', '张仪', '外交部', '部长', 2650, '1月', '未结算');
INSERT INTO `view_salary` VALUES (21, '0013', '朱元璋', '技术科', '部长', 2550, '1月', '未结算');
INSERT INTO `view_salary` VALUES (22, '0001', '赢政', '经理室', '经理', 2900, '2月', '未结算');
INSERT INTO `view_salary` VALUES (23, '0001', '赢政', '经理室', '经理', 2950, '3月', '未结算');
INSERT INTO `view_salary` VALUES (24, '0002', '刘邦', '技术室', '技术长', 2900, '2月', '未结算');
INSERT INTO `view_salary` VALUES (25, '0002', '刘邦', '技术室', '技术长', 2850, '3月', '未结算');
INSERT INTO `view_salary` VALUES (26, '0003', '武则天', '财务室', '经理', 2850, '2月', '未结算');
INSERT INTO `view_salary` VALUES (27, '0003', '武则天', '财务室', '经理', 2570, '3月', '未结算');
INSERT INTO `view_salary` VALUES (35, '0004', '刘秀', '军机部', '副部长', 2850, '3月', '未结算');
INSERT INTO `view_salary` VALUES (36, '0004', '刘秀', '军机部', '副部长', 2750, '2月', '未结算');
INSERT INTO `view_salary` VALUES (37, '0005', '西施', '财务室', '会计', 2800, '2月', '未结算');
INSERT INTO `view_salary` VALUES (39, '0005', '西施', '财务室', '会计', 2750, '3月', '未结算');
INSERT INTO `view_salary` VALUES (40, '0006', '李清照', '财务室', '出纳', 2800, '2月', '未结算');
INSERT INTO `view_salary` VALUES (41, '0006', '李清照', '财务室', '出纳', 2800, '3月', '未结算');
INSERT INTO `view_salary` VALUES (42, '0001', '赢政', '经理室', '经理', 1, '1月', '未结算');
SET FOREIGN_KEY_CHECKS = 1;
二、系统展示
1.登录系统
2.用户-登录系统
3.用户-查看工资
4.管理员-主界面
5.管理员-添加员工信息
6.管理员-修改员工信息
7.管理员-洗掉员工信息
8.管理员-添加部门信息
9.管理员-修改部门信息
10.管理员-洗掉部门信息
11.管理员-工资设定
12.管理员-工资查询
13.管理员-工资一览
三、部分代码
Login.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Login.java
*
* Created on 2013-6-16, 21:34:00
*/
package com.sjsq;
import java.awt.Toolkit;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JOptionPane;
/**
*
* @author Administrator
*/
public class Login extends javax.swing.JFrame {
static String status;
static String name;
private Toolkit tk = Toolkit.getDefaultToolkit();
int x = tk.getScreenSize().width / 2 - 180;
int y = tk.getScreenSize().height / 2 - 180;
/** Creates new form Login */
public Login() {
initComponents();
setLocation(x, y);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated
// Code">//GEN-BEGIN:initComponents
private void initComponents() {
jComboBox1 = new javax.swing.JComboBox();
username = new javax.swing.JTextField();
jPasswordField1 = new javax.swing.JPasswordField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("登录界面");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "管理员", "员工" }));
jComboBox1.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
// TODO Auto-generated method stub
if (e.getStateChange() == ItemEvent.SELECTED) {
if ("员工".equals(e.getItem())) {
jButton1.setText("查询工资");
jLabel2.hide();
username.hide();
jPasswordField1.hide();
jLabel3.hide();
jPasswordField1.hide();
} else {
jButton1.setText("登录");
jLabel2.show();
username.show();
jPasswordField1.show();
jLabel3.show();
jPasswordField1.show();
}
}
}
});
// username.setText("quan");
jLabel1.setText("身份:");
jLabel2.setText("账号:");
jLabel3.setText("密码:");
jButton1.setText("登录");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("退出");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel4.setForeground(new java.awt.Color(255, 0, 0));
jLabel4.setText("注:员工可以匿名登录");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
.createSequentialGroup().addGap(80, 80, 80)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1).addComponent(jLabel3).addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 92,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(username, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.LEADING, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18).addComponent(jLabel4))))
.addGroup(layout.createSequentialGroup().addGap(110, 110, 110).addComponent(jButton1)
.addGap(39, 39, 39).addComponent(jButton2)))
.addContainerGap(54, Short.MAX_VALUE)));
layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addGap(65, 65, 65)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1).addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(username, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3).addComponent(jPasswordField1,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1).addComponent(jButton2))
.addContainerGap(102, Short.MAX_VALUE)));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
status = (String) jComboBox1.getSelectedItem();
name = username.getText();
String password = jPasswordField1.getText();
if (status.equals("管理员")) {
if (name.equals("")) {
JOptionPane.showMessageDialog(null, "用户名不能为空!!");
} else if (password.equals("")) {
JOptionPane.showMessageDialog(null, "密码不能为空!!");
} else {
String sql = "select username from userlist where status = '" + status + "' and username = '" + name
+ "' and password = '" + password + "'";
// String sql = "select * from userlist";
System.out.println(sql);
DBConn db = new DBConn();
if (db.Check(sql) != 0) {
new MainFrame().setVisible(true);
this.hide();
} else {
JOptionPane.showMessageDialog(null, "用户名与密码不对!!");
}
}
} else {
new SalarySearch().setVisible(true);
}
}// GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
int selection = JOptionPane.showConfirmDialog(this, "是否退出?", "退出提示", JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE);
if (selection == JOptionPane.OK_OPTION) {
System.exit(0);
}
}// GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JTextField username;
// End of variables declaration//GEN-END:variables
}
MainFrame.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* MainFrame.java
*
* Created on 2013-6-18, 22:12:20
*/
package com.sjsq;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JOptionPane;
/**
*
* @author Administrator
*/
public class MainFrame extends javax.swing.JFrame {
/** Creates new form MainFrame */
private Toolkit tk = Toolkit.getDefaultToolkit();
int x = tk.getScreenSize().width / 2 - 250;
int y = tk.getScreenSize().height / 2 - 250;
public MainFrame() {
setTitle("工资管理系统");
setLocation(x, y);
initComponents();
// this.setDefaultCloseOperation(MainFrame.DO_NOTHING_ON_CLOSE);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated
// Code">//GEN-BEGIN:initComponents
private void initComponents() {
jColorChooser1 = new javax.swing.JColorChooser();
jPanel1 = new javax.swing.JPanel() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Image img = Toolkit.getDefaultToolkit().getImage("src/resource/009.jpg");
Graphics gg = g.create();
gg.drawImage(img, 0, 0, getWidth(), getHeight(), this);
gg.dispose();
}
};
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenuItem7 = new javax.swing.JMenuItem();
jMenuItem8 = new javax.swing.JMenuItem();
jMenuItem12 = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem9 = new javax.swing.JMenuItem();
jMenuItem10 = new javax.swing.JMenuItem();
jMenuItem13 = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
jMenuItem11 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jPanel1.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
jPanel1AncestorAdded(evt);
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 637, Short.MAX_VALUE));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 365, Short.MAX_VALUE));
jMenu1.setText("员工信息管理");
jMenu1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jM
标签:
发表评论
您的电子邮件地址不会被公开。 必填的字段已做标记 *
0 评论