Java普通员工管理系统
login GUI界面(登录)
package 普通员工管理系统; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField; public class Login extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel userlabel =new JLabel("用户名:");
private JLabel passwordlabel = new JLabel("密码:");
private JTextField usertext = new JTextField();
private JPasswordField passwordtext = new JPasswordField();
private JButton but1 = new JButton("确定");
private JButton but2 = new JButton("取消"); public Login()
{
this.setSize(500, 300);
this.setLocation(200, 200);
this.setTitle("用户登录"); this.setLayout(null);
userlabel.setBounds(120, 20, 50, 30);
passwordlabel.setBounds(120, 100, 50, 30);
usertext.setBounds(200, 20, 150, 30);
passwordtext.setBounds(200, 100, 150, 30);
but1.setBounds(150, 150, 80, 30);
but2.setBounds(250, 150, 80, 30);
this.add(userlabel);
this.add(passwordlabel);
this.add(usertext);
this.add(passwordtext);
this.add(but1);
this.add(but2); but1.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String name = usertext.getText(); //获取文本框数据
String password = new String(passwordtext.getPassword()); //获取密码框数据
if("admin".equals(name)&&"123".equals(password)) //判断
{
JOptionPane.showMessageDialog(null, "真牛逼,密码对了"); //弹出消息框
}
else {
JOptionPane.showMessageDialog(null, "用户名或错误"); //弹出消息框
usertext.setText("");
passwordtext.setText("");
}
}
});
passwordtext.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String name = usertext.getText(); //获取文本框数据
String password = new String(passwordtext.getPassword()); //获取密码框数据
if("admin".equals(name)&&"123".equals(password)) //判断
{
new Home();
JOptionPane.showMessageDialog(null, "真牛逼,密码对了"); //弹出消息框 Login.this.dispose();
}
else {
JOptionPane.showMessageDialog(null, "用户名或错误"); //弹出消息框
usertext.setText("");
passwordtext.setText("");
}
}
});
this.setVisible(true);
} public static void main(String[] args) {
// TODO Auto-generated method stub
new Login(); } }
Home GUI界面(主界面)
package 普通员工管理系统; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem; public class Home extends JFrame { /**
*
*/
private static final long serialVersionUID = -1131044405944264320L; public Home()
{
this.setSize(600, 400);
this.setLocation(200, 200);
this.setTitle("普通员工界面"); //创建菜单栏
JMenuBar mbr = new JMenuBar(); //菜单栏
this.setJMenuBar(mbr); //添加菜单栏到容器 //创建菜单
JMenu men = new JMenu("功能管理"); //菜单
JMenu men1 = new JMenu("系统管理");
mbr.add(men); //添加菜单到菜单栏
mbr.add(men1); //创建菜单项
JMenuItem ltem1 = new JMenuItem("查看个人信息"); //菜单项
JMenuItem ltem2 = new JMenuItem("汇报工作");
JMenuItem ltem3 = new JMenuItem("修改密码");
JMenuItem ltem4 = new JMenuItem("查看测评成绩"); JMenuItem ltem5 = new JMenuItem("登录");
JMenuItem ltem6 = new JMenuItem("问卷");
men.add(ltem1); //添加菜单项到菜单
men.add(ltem2);
men.add(ltem3);
men.add(ltem4);
men1.add(ltem5);
men1.add(ltem6);
//创建菜单项事件
ltem1.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
new Information();
//setVisible(false);
}
}); ltem2.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Work();
//setVisible(false);
}
}); ltem3.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Password();
//setVisible(false);
}
}); ltem4.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Achievement();
//setVisible(false); }
});
ltem5.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Login();
setVisible(false);
}
});
ltem6.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
//setVisible(false);
new Questionnaire();
}
});
this.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Home();
} }
Information GUI界面(个人信息)
package 普通员工管理系统; import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField; public class Information extends JFrame { /**
*
*/
private static final long serialVersionUID = 1L;
private JLabel l1 = new JLabel("编号:");
private JLabel l2 = new JLabel("姓名:");
private JLabel l3 = new JLabel("性别:");
private JLabel l4 = new JLabel("级别:");
private JLabel l5 = new JLabel("部门:");
private JLabel l6 = new JLabel("薪资:"); private JTextField t1 = new JTextField("0007");
private JTextField t2 = new JTextField("刘强");
private JTextField t3 = new JTextField("女");
private JTextField t4 = new JTextField("普通用户");
private JTextField t5 = new JTextField("技术部");
private JTextField t6 = new JTextField("4000.0"); public Information()
{
this.setSize(600, 400);
this.setLocation(200, 200);
this.setTitle("查看个人信息");
this.setLayout(null);
l1.setBounds(100, 20, 50, 30);
l2.setBounds(100, 60, 50, 30);
l3.setBounds(100, 100, 50, 30);
l4.setBounds(100, 140, 50, 30);
l5.setBounds(100, 180, 50, 30);
l6.setBounds(100, 220, 50, 30); t1.setBounds(200, 25, 250, 20);
t2.setBounds(200, 65, 250, 20);
t3.setBounds(200, 105, 250, 20);
t4.setBounds(200, 145, 250, 20);
t5.setBounds(200, 185, 250, 20);
t6.setBounds(200, 225, 250, 20); this.add(l1);
this.add(l2);
this.add(l3);
this.add(l4);
this.add(l5);
this.add(l6);
this.add(t1);
this.add(t2);
this.add(t3);
this.add(t4);
this.add(t5);
this.add(t6);
this.setVisible(true);
} public static void main(String[] args) {
// TODO Auto-generated method stub
new Information(); } }
Work GUI界面(汇报工作)
package 普通员工管理系统; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextField; public class Work extends JFrame { /**
*
*/
private static final long serialVersionUID = 1L;
private JLabel l1 = new JLabel("汇报人编号:");
private JLabel l2 = new JLabel("汇报内容:");
private JTextField t1 = new JTextField();
private JTextArea tx2 = new JTextArea(50,50);
private JButton but1 = new JButton("提交"); public Work()
{
this.setSize(600, 400);
this.setTitle("汇报工作");
this.setLocation(200, 200); this.setLayout(null); l1.setBounds(80, 10, 100, 30);
t1.setBounds(180, 10, 150, 30); l2.setBounds(80, 80, 100, 30);
tx2.setBounds(180, 80, 250, 150); but1.setBounds(220, 280, 100, 30);
this.add(l1);
this.add(t1);
this.add(l2);
this.add(tx2);
this.add(but1); but1.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Home();
setVisible(false);
}
}); this.setVisible(true); } public static void main(String[] args) {
// TODO Auto-generated method stub
new Work(); } }
Password GUI界面(密码重置)
package 普通员工管理系统; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField; public class Password extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel pslable1 = new JLabel("旧密码:");
private JLabel pslable2 = new JLabel("新密码:");
private JLabel pslable3 = new JLabel("确定密码:"); private JPasswordField psf1 = new JPasswordField();
private JPasswordField psf2 = new JPasswordField();
private JPasswordField psf3 = new JPasswordField(); private JButton but1 = new JButton("修改"); public Password()
{
this.setSize(600, 400);
this.setLocation(200, 200);
this.setTitle("重置密码"); this.setLayout(null); pslable1.setBounds(100, 10, 100, 30);
pslable2.setBounds(100, 80, 100, 30);
pslable3.setBounds(100, 150, 100, 30);
psf1.setBounds(200, 10, 150, 30);
psf2.setBounds(200, 80, 150, 30);
psf3.setBounds(200, 150, 150, 30);
but1.setBounds(250, 230, 70,40);
this.add(pslable1);
this.add(pslable2);
this.add(pslable3);
this.add(psf1);
this.add(psf2);
this.add(psf3);
this.add(but1); but1.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
setVisible(false);
new Login(); }
});
this.setVisible(true);
} public static void main(String[] args) {
// TODO Auto-generated method stub
new Password(); } }
Achievement GUI界面(成绩查询)
package 普通员工管理系统; import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable; public class Achievement extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
Object[] columnTitle = { "被评测人", "评测经理", "评测成绩" };
Object[][] tableDate = {
new Object[] { "0001", "0002", "89.0" },
new Object[] { "0003", "0002", "77.0" },
new Object[] { "0004", "0002", "23.0" }
};
private JTable tb1 = new JTable(tableDate, columnTitle);
private JLabel lab1 = new JLabel("测评成绩如下:");
private JScrollPane tp1 = new JScrollPane(); public Achievement()
{
this.setSize(600, 400);
this.setTitle("测评成绩");
this.setLocation(200, 200);
//this.setLayout(new FlowLayout(FlowLayout.LEFT, 10,10));
this.setLayout(new BorderLayout());
//this.add(new JScrollPane(tb1));
//this.setLayout(null);
this.add(lab1,BorderLayout.NORTH);
this.add(new JScrollPane(tb1),BorderLayout.CENTER);
this.setVisible(true);
} public static void main(String[] args) {
// TODO Auto-generated method stub
new Achievement(); } }
Questionnaire GUI界面(调查问卷)
package 普通员工管理系统; import javax.swing.*;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton; public class Questionnaire extends JFrame { /**
*
*/
private static final long serialVersionUID = 1L; //按钮
private JButton bt = new JButton("提交"); //标签
private JLabel l0 = new JLabel("基本情况调查表");
private JLabel l1 = new JLabel("1.喜欢的体育运动:");
private JLabel l2 = new JLabel("2.性别");
private JLabel l3 = new JLabel("3.出生年份:");
private JLabel l4 = new JLabel("4.联系方式:");
private JLabel l5 = new JLabel("5.将您的其他爱好填写到下面区域中:"); //复选框
private JCheckBox cb1 = new JCheckBox("足球");
private JCheckBox cb2 = new JCheckBox("羽毛球");
private JCheckBox cb3 = new JCheckBox("篮球"); //单选框
private JRadioButton rb1 = new JRadioButton("男");
private JRadioButton rb2 = new JRadioButton("女"); //下拉列表
String st[] = {"1978","1979","1976"};
private JComboBox Cob = new JComboBox(st); //文本框
private JTextField tx = new JTextField(); //文本域
private JTextArea tx2 = new JTextArea(50,40); public Questionnaire()
{
this.setSize(400, 500);
this.setLocation(600, 200);
this.setTitle("调查问卷");
this.setLayout(null); //标题定位
l0.setBounds(150, 5, 100, 20); //问题1定位
l1.setBounds(0, 20, 150, 20);
cb1.setBounds(0, 40, 150, 20);
cb2.setBounds(0, 60, 150, 20);
cb3.setBounds(0, 80, 150, 20); //问题2定位
l2.setBounds(0, 100, 150, 20);
rb1.setBounds(0, 120, 150, 20);
rb2.setBounds(0, 140, 150, 20); //问题3定位
l3.setBounds(0, 160, 150, 20);
Cob.setBounds(80, 160, 80, 20); //问题4定位
l4.setBounds(0, 200, 150, 20);
tx.setBounds(90, 200, 100, 20); //问题5布局
l5.setBounds(0, 240, 300, 20);
tx2.setBounds(0, 260, 300,100 ); //按钮布局
bt.setBounds(160, 390,60, 30); this.add(l0); this.add(l1);
this.add(cb1);
this.add(cb2);
this.add(cb3); this.add(l2);
this.add(rb1);
this.add(rb2); this.add(l3);
this.add(Cob); this.add(l4);
this.add(tx); this.add(l5);
this.add(tx2); this.add(bt);
this.setVisible(true);
} public static void main(String[] args) {
// TODO Auto-generated method stub
new Questionnaire(); } }
Java普通员工管理系统的更多相关文章
- 基于SSM实现的简易员工管理系统(网站上线篇)
经历无数苦难,好不容易,网站终于上线了.=.=内牛满面ing.chengmingwei.top就是本员工管理系统的主页啦.是的,很简陋,但是毕竟是第一次嘛,所以慢慢来嘛. 如上次所说的(网站简介,见: ...
- 基于SSM实现的简易员工管理系统
之前自学完了JAVA基础,一直以来也没有做什么好玩的项目,最近暑假,时间上比较空闲,所以又学习了一下最近在企业实际应用中比较流行的SSM框架,以此为基础,通过网络课程,学习编写了一个基于SSM实现的M ...
- 基于SSH实现员工管理系统之框架整合篇
本篇文章来源于:https://blog.csdn.net/zhang_ling_yun/article/details/77803178 以下内容来自慕课网的课程:基于SSH实现员工管理系统之框架整 ...
- 员工管理系统(集合与IO流的结合使用 beta1.0 ArrayList<Employee>)
package cn.employee; public class Employee { private int empNo; private String name; private String ...
- 员工管理系统(集合与IO流的结合使用 beta2.0 ObjectInputStream/ ObjectOutputStream)
package cn.employee; import java.io.Serializable; public class Employee implements Serializable{ pri ...
- 员工管理系统(集合与IO流的结合使用 beta5.0 BufferedReader/ BufferedWriter)
package cn.gee; public class Emp { private String id;//员工编号 一般是唯一的 private String sname; private int ...
- 员工管理系统(集合与IO流的结合使用 beta4.0 ObjectInputStream/ ObjectOutputStream)
package cn.employee_io; import java.io.Serializable; public class Employee implements Serializable{ ...
- 员工管理系统(集合与IO流的结合使用 beta3.0 BufferedReader / ObjectOutputStream)
Employee.java package cn.employee_io; public class Employee { private String empId; private String n ...
- 简单的员工管理系统(Mysql+jdbc+Servlet+JSP)
员工管理系统 因为学业要求,需要完成一个过关检测,但是因为检测之前没有做好准备,且想到之前用mysql+jdbc+Struts2+bootstrap做成了一个ATM系统(主要有对数据的增删改查操作), ...
随机推荐
- POI 读取 Excel 文件
import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.Out ...
- Bootstrap历练实例:输入框组的大小
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- Bootstrap历练实例:垂直的按钮组
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- shell脚本,按空格开始60秒的倒计时。
[root@localhost wyb]# cat space.sh #!/bin/bash #按空格开始60秒的倒计时#-n表示接受字符的数量,1表示只接受一个字符 a() { - ` do ec ...
- jdk环境变量配置(参考自《疯狂java讲义》)
做个记录,免得每次配环境都要百度 环境变量的配置 path环境变量配置的作用:程序的执行需要使用外部指令javac, 但是javac指令仅仅能在JDK安装目录下的bin目录下使用,因此程序只能写入bi ...
- tkinter学习-布局管理器
阅读目录 pack 是按照添加顺序排列的组件 grid 是按照行/列形式排序的组件 place 允许程序员指定组件的大小和位置 pack: 说明:适用于少量的简单的组件的排列 fill:这个选项是告 ...
- 【git】自动换行转换autocrlf
#####windows git config --global core.autocrlf true #####linux git config --global core.autocrlf inp ...
- ACM训练联盟周赛 G. Teemo's convex polygon
65536K Teemo is very interested in convex polygon. There is a convex n-sides polygon, and Teemo co ...
- bs4--官文--遍历文档树
遍历文档树 还拿”爱丽丝梦游仙境”的文档来做例子: html_doc = """ <html><head><title>The Dor ...
- Knockout v3.4.0 中文版教程-11-控制文本内容和外观-text绑定
2. text绑定 目的 text绑定把传入的参数通过关联的DOM元素来显示文本值. 通常这对像<span>或<em>标签等使用,但技术上你可以对任何元素使用该绑定. 例子 T ...