package com.example.salarysystem;
import bean.Employee;
import bean.Manager;
import bean.User;
import dao.EmpDao;
import dao.ManagerDao;
import dao.UserDao;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.stage.Stage;
import util.DBManager;
import java.net.PasswordAuthentication;
import java.sql.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.List;
public class Login extends Application {
static Connection conn = null;
static PreparedStatement ps = null;
static ResultSet rs = null;
public EmpDao empDao = new EmpDao();
public ManagerDao managerDao = new ManagerDao();
public UserDao userDao = new UserDao();
public Alert alert = new Alert(Alert.AlertType.INFORMATION);
String contentText = "";
Stage stage = new Stage();
//主界面
GridPane mainPane = new GridPane();
Scene mainScene = new Scene(mainPane, 600, 500);
//管理员界面
GridPane managerPane = new GridPane();
Scene managerScene = new Scene(managerPane, 600, 500);
//管理员修改密码界面
GridPane managerModifyPwPane = new GridPane();
Scene managerModifyPwScene = new Scene(managerModifyPwPane, 600, 500);
//菜单界面
GridPane employeeMenuPane = new GridPane();
Scene employeeMenuScene = new Scene(employeeMenuPane, 600, 500);
//添加人员信息
GridPane addPane = new GridPane();
Scene addScene = new Scene(addPane, 600, 500);
DatePicker datePicker = new DatePicker();
//修改人员信息
GridPane prePane = new GridPane();
Scene preScene = new Scene(prePane,600,500);
GridPane modifyPane = new GridPane();
Scene modifyScene = new Scene(modifyPane, 600, 500);
//删除人员信息
GridPane deletePane = new GridPane();
Scene deleteScene = new Scene(deletePane, 600, 500);
//搜索人员信息
GridPane preSearchPane = new GridPane();
Scene preSearchScene = new Scene(preSearchPane,600,500);
GridPane searchPane = new GridPane();
Scene searchScene = new Scene(searchPane, 600, 500);
//员工登陆界面
GridPane userPane = new GridPane();
Scene userScene = new Scene(userPane, 600, 500);
//员工更改密码界面
GridPane userModifyPwPane = new GridPane();
Scene userModifyPwScene = new Scene(userModifyPwPane, 600, 500);
//显示员工个人信息界面
GridPane personalInfoPane = new GridPane();
Scene personalInfoScene = new Scene(personalInfoPane, 600, 500);
StackPane root = new StackPane();
@Override
public void start(Stage stage) throws Exception {
choose();
managerLogin();
// managerModifyPw();
userLogin();
userModifyPw();
menu();
addEmployee();
preModifyEmployee();
modifyEmployee();
deleteEmployee();
preSearchEmployee();
stage.setScene(mainScene);
stage.setTitle("员工工资管理系统");
stage.setResizable(false);
stage.show();
}
//选择角色
void choose(){
Label title = new Label("欢迎进入系统");
title.setFont(Font.font("T", FontWeight.LIGHT, FontPosture.ITALIC, 30));
Label warn = new Label("账号或密码错误");
warn.setTextFill(Color.RED);
warn.setVisible(false);
warn.setFont(Font.font("T", FontPosture.ITALIC, 20));
Button managerButton = new Button("管理员");
managerButton.setTranslateX(100);
managerButton.setTranslateY(320);
Button userButton = new Button("员工");
userButton.setTranslateX(320);
userButton.setTranslateY(320);
mainPane.setHgap(20);
mainPane.setVgap(20);
mainPane.setPadding(new Insets(0, 10, 10, 30));
mainPane.add(title,4,3);
mainPane.add(warn,4,6);
mainPane.getChildren().addAll(managerButton,userButton);
mainPane.setStyle("-fx-background-image: url(" + "file:src/image/mist.jpg" + "); "
+ "-fx-background-position: center center; " + "-fx-background-repeat: stretch;"
+ "-fx-background-color: transparent;" + "-fx-background-size: 850px;");
managerButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
stage.setScene(managerScene);
stage.show();
}
});
userButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
stage.setScene(userScene);
stage.show();
}
});
}
//管理员登录 默认密码1234
void managerLogin(){
Label title = new Label("欢迎管理员进入");
Label manId = new Label("账号");
manId.setFont(Font.font("T",FontWeight.LIGHT, FontPosture.ITALIC, 15));
Label password = new Label("密码:");
password.setFont(Font.font("T",FontWeight.LIGHT, FontPosture.ITALIC, 15));
title.setFont(Font.font("T", FontWeight.LIGHT, FontPosture.ITALIC, 20));
Label warn = new Label("密码错误!");
warn.setTextFill(Color.RED);
warn.setVisible(false);
warn.setFont(Font.font("T", FontPosture.ITALIC, 20));
TextField id = new TextField();
PasswordField pw = new PasswordField();
Button ok = new Button("确认");
ok.setTranslateX(100);
ok.setTranslateY(320);
Button change = new Button("更改密码");
change.setTranslateX(320);
change.setTranslateY(320);
Button back = new Button("返回");
back.setTranslateX(210);
back.setTranslateY(320);
managerPane.setHgap(20);
managerPane.setVgap(20);
managerPane.setPadding(new Insets(20,10,10,100));
managerPane.add(title,1,0);
managerPane.add(manId,1,3);
managerPane.add(id,2,3);
managerPane.add(password, 1, 4);
managerPane.add(pw,2,4);
managerPane.add(warn, 4, 6);
managerPane.getChildren().addAll(ok, change,back);
managerPane.setStyle("-fx-background-image: url(" + "file:src/image/mist.jpg" + "); "
+ "-fx-background-position: center center; " + "-fx-background-repeat: stretch;"
+ "-fx-background-color: transparent;" + "-fx-background-size: 850px;");
//管理员登录确认
ok.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String manId_1 = id.getText();
String password = pw.getText();
Manager manager = managerDao.findByManAndPassword(manId_1,password);
if (manager != null){
stage.setScene(employeeMenuScene);
stage.setTitle("员工工资管理系统");
}else{
contentText = "账号或密码错误!";
alert.setContentText(contentText);
alert.show();
}
}
});
//更改密码事件
change.setOnAction(new EventHandler<ActionEvent>() {
@Override
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SalarySystem.zip (82个子文件)
SalarySystem
mvnw.cmd 7KB
lib
mysql.properties 146B
mysql-connector-java-5.1.7-bin.jar 693KB
pom.xml 4KB
src
image
mist.jpg 132KB
forest.jpg 368KB
snowmount.jpg 281KB
main
resources
com
example
salarysystem
hello-view.fxml 1KB
java
module-info.java 254B
dao
UserDao.java 3KB
ManagerDao.java 3KB
EmpDao.java 12KB
test
EmployeeFindAllTest.java 3KB
util
DBManager.java 2KB
bean
Manager.java 452B
Employee.java 2KB
User.java 804B
com
example
salarysystem
Login.java 47KB
SQL文件
userlog.sql 1KB
empinfo.sql 2KB
manager.sql 926B
out
production
SalarySystem
module-info.class 310B
dao
UserDao.class 3KB
ManagerDao.class 3KB
EmpDao.class 6KB
test
EmployeeFindAllTest.class 663B
util
DBManager.class 2KB
bean
User.class 852B
Manager.class 769B
Employee.class 3KB
com
example
salarysystem
Login$17.class 1KB
Login$16.class 5KB
Login$25.class 1KB
Login$18.class 2KB
Login$4.class 3KB
Login$14.class 1KB
Login$7.class 1KB
hello-view.fxml 1KB
Login$6.class 5KB
Login$13.class 1KB
Login$9.class 3KB
Login$21.class 1KB
Login$22.class 2KB
Login$15.class 1KB
Login$8.class 1KB
Login.class 16KB
Login$2.class 1KB
Login$10.class 1KB
Login$4$2.class 1KB
Login$20.class 6KB
Login$23.class 1KB
Login$11.class 1KB
Login$1.class 1KB
Login$12.class 1KB
Login$24$1.class 1KB
Login$4$1.class 3KB
Login$5.class 1KB
Login$19.class 1KB
Login$3.class 2KB
Login$24.class 5KB
.idea
jarRepositories.xml 864B
dataSources
9f558f95-fd1a-41f5-aef6-04f4a685da72
storage_v2
_src_
schema
performance_schema.kIw0nw.meta 76B
sys.zb4BAA.meta 61B
information_schema.FNRwLQ.meta 76B
mysql.osA4Bg.meta 63B
9f558f95-fd1a-41f5-aef6-04f4a685da72.xml 33KB
dataSources.local.xml 1001B
uiDesigner.xml 9KB
artifacts
SalarySystem.xml 351B
libraries
lib__2_.xml 270B
lib__3_.xml 270B
lib.xml 266B
workspace.xml 9KB
misc.xml 579B
SalarySystem.iml 344B
dataSources.xml 839B
compiler.xml 545B
modules.xml 283B
.gitignore 50B
encodings.xml 1KB
target
generated-sources
annotations
mvnw 10KB
.gitignore 490B
共 82 条
- 1
资源评论
nopompous
- 粉丝: 35
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python智能教育系统案例介绍: 开发一个个性化学习推荐系统,根据学生的学习情况和兴趣,推荐适合的学习资源和课程
- Python金融风控系统案例介绍: 基于机器学习和数据分析技术,设计一个能够预测金融风险和欺诈行为的系统
- wireshark抓包及分析.zip
- Python智能客服机器人案例介绍: 开发一个能够自动回答用户问题、处理客户服务请求的智能客服机器人,可以基于自然语言处理
- Python医疗影像识别案例介绍: 开发一个能够识别医学影像中病变或异常情况的系统,如肿瘤检测、骨折识别等
- 前端面试题之Html相关题集.zip
- Python智能推荐系统案例介绍: 基于用户行为数据和机器学习算法,设计一个个性化推荐系统,如电影推荐、音乐推荐等
- Animation engine for explanatory math videos 用于解释数学视频的动画引擎
- Python自然语言处理应用案例介绍: 开发一个能够进行文本情感分析、语义理解或机器翻译等任务的自然语言处理应用
- Python基于深度学习的图像识别系统案例介绍: 利用深度学习技术,设计一个能够识别物体、人脸或文字等图像内容的系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功