工资系统代码JAVA版Word格式.docx

上传人:b****1 文档编号:15359336 上传时间:2022-10-29 格式:DOCX 页数:45 大小:24.57KB
下载 相关 举报
工资系统代码JAVA版Word格式.docx_第1页
第1页 / 共45页
工资系统代码JAVA版Word格式.docx_第2页
第2页 / 共45页
工资系统代码JAVA版Word格式.docx_第3页
第3页 / 共45页
工资系统代码JAVA版Word格式.docx_第4页
第4页 / 共45页
工资系统代码JAVA版Word格式.docx_第5页
第5页 / 共45页
点击查看更多>>
下载资源
资源描述

工资系统代码JAVA版Word格式.docx

《工资系统代码JAVA版Word格式.docx》由会员分享,可在线阅读,更多相关《工资系统代码JAVA版Word格式.docx(45页珍藏版)》请在冰豆网上搜索。

工资系统代码JAVA版Word格式.docx

JButtonbutton2=newJButton("

退出系统"

ImageIconim=newImageIcon("

1.jpg"

JLabela1=newJLabel(im);

voidCreate()

{

JPanelpcontentPane=(JPanel)frame.getContentPane();

pcontentPane.add(a1);

pcontentPane.setLayout(newFlowLayout());

pcontentPane.add(button1);

pcontentPane.add(button2);

pcontentPane.setVisible(true);

button1.addActionListener(this);

button2.addActionListener(this);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.pack();

frame.setLocationRelativeTo(null);

frame.setVisible(true);

}

publicstaticvoidmain(String[]args)

{

WagesSystemdome=newWagesSystem();

dome.Create();

publicvoidactionPerformed(ActionEvente)

if(button1.equals(e.getSource()))

{

DLdl=newDL();

dl.create();

frame.dispose();

}

if(button2.equals(e.getSource()))

{

System.exit(0);

}

 

/*登录界面*/

importjava.awt.HeadlessException;

importjava.awt.event.ActionEvent;

importjava.awt.event.ActionListener;

importjava.sql.Connection;

importjava.sql.DriverManager;

importjava.sql.ResultSet;

importjava.sql.SQLException;

importjava.sql.Statement;

importjavax.swing.JButton;

importjavax.swing.JFrame;

importjavax.swing.JLabel;

importjavax.swing.JOptionPane;

importjavax.swing.JPasswordField;

importjavax.swing.JTextField;

import.*;

importjava.sql.*;

classDLextendsJFrameimplementsActionListener

{

NetConnsql;

Statementsqll;

ResultSetrs;

职工/管理员登陆"

JLabellabel1=newJLabel("

用户名"

JLabellabel2=newJLabel("

密码"

JButtonlogonButton1=newJButton("

系统管理员登录"

JButtonlogonButton2=newJButton("

教职工登录"

JButtonlogonButton3=newJButton("

财务管理员登录"

JButtoncancelButton=newJButton("

退出"

JTextFieldusername=newJTextField(9);

JPasswordFieldpassword=newJPasswordField(9);

staticStringt1;

staticStringt2;

voidcreate()

frame.setLayout(null);

label1.setBounds(60,20,50,20);

frame.add(label1);

username.setBounds(130,20,150,20);

frame.add(username);

label2.setBounds(60,50,50,20);

frame.add(label2);

password.setBounds(130,50,150,20);

frame.add(password);

logonButton1.setBounds(100,90,150,20);

frame.add(logonButton1);

logonButton2.setBounds(100,120,150,20);

frame.add(logonButton2);

logonButton3.setBounds(100,150,150,20);

frame.add(logonButton3);

cancelButton.setBounds(100,180,150,20);

frame.add(cancelButton);

logonButton1.addActionListener(this);

logonButton2.addActionListener(this);

logonButton3.addActionListener(this);

cancelButton.addActionListener(this);

sql=newNetConn();

//建立数据库连接

frame.setSize(350,250);

}

@SuppressWarnings("

deprecation"

t1=username.getText();

t2=password.getText();

//系统管理员登录

if(e.getSource()==logonButton1)

if(username.getText().equals("

admin"

)==true

&

&

(password.getText().equals("

)==true))

{

JOptionPane.showMessageDialog(this,"

登录成功!

"

xtglya=newxtgly();

frame.dispose();

}

else

JOptionPane.showMessageDialog(null,"

输入用户名或密码错误!

}

}

//教职工登陆

if(e.getSource()==logonButton2)

sqll=sql.connect();

try

rs=sqll.executeQuery("

SELECT*FROMuser_teacherwherename="

+"

'

+username.getText()+"

Stringsname,spass;

if(rs.next())

{

sname=rs.getString

(2);

spass=rs.getString(3);

if((password.getText().trim().equals(spass))&

(username.getText().trim().equals(sname)))

{

JOptionPane.showMessageDialog(this,"

Teacher_Pa=newTeacher_P();

a.creat(rs.getString

(1));

frame.dispose();

}

else

JOptionPane.showMessageDialog(null,"

}

}

else

JOptionPane.showMessageDialog(null,"

用户不存在!

catch(SQLExceptione2){

//TODO自动生成的catch块

e2.printStackTrace();

//财务登陆

if(e.getSource()==logonButton3)

SELECT*FROMuser_cwwherename="

CW

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 纺织轻工业

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1