📄 gongziguanli.txt
字号:
P: for(int i=0;i<number3;i++)
{ Wage cus_3=(Wage)list.get(i);
if(cus_3.s1.equals(ss13))
{ a3=i;b3=false;break P;}
}
if(b3==true)
{JOptionPane.showMessageDialog(null,"没有此职工编号为"+ss13+"的工资!!!");}
else
{ Wage mov=(Wage)list.get(a3);
{ list.remove(a3); }
try{FileOutputStream file32=new FileOutputStream("zhigong1.txt");
ObjectOutputStream out32 =new ObjectOutputStream(file32);
out32.writeObject(list);//
out32.close();
}
catch(IOException event){}
}
}
}
//查询方法
else if(e.getSource()==b_xun)
{ T15.setText(null);
showT.setText(null);
String ss14 = JOptionPane.showInputDialog(z2.this, "输入您需要的职工信息的编号" );
try{ FileInputStream come_in42=new FileInputStream("zhigong1.txt");
ObjectInputStream in42 =new ObjectInputStream(come_in42);
list=(LinkedList)in42.readObject();
in42.close();
}
catch(ClassNotFoundException event){}
catch(IOException event){}
boolean b4=true;int a4=0;
int number4=list.size();
P: for(int i=0;i<number4;i++)
{ Wage cus_4=(Wage)list.get(i);
if(cus_4.s1.equals(ss14))
{ a4=i;b4=false;break P;}
}
if(b4==true)
{JOptionPane.showMessageDialog(null,"没有此职工编号为"+ss14+"的工资!!!");}
else
{ Wage cha=(Wage)list.get(a4);
showT.append("\t\t职工工资条");
showT.append("\n ");
showT.append("\t\t\t"+new java.util.Date().toString());
showT.append("\n ");
showT.append("编 号:"+cha.s1);
showT.append("\t姓 名:"+cha.s2);
showT.append("\n ");
showT.append("基本工资:"+cha.s3);
showT.append("\t职务工资:"+cha.s4);
showT.append("\t奖 金:"+cha.s5);
showT.append("\n ");
showT.append("误餐补贴:"+cha.s6);
showT.append("\t高寒补贴:"+cha.s7);
showT.append("\t应发工资:"+cha.s8);
showT.append("\n ");
showT.append("扣 款:"+cha.s9);
showT.append("\t房 租:"+cha.s10);
showT.append("\t水 电 费:"+cha.s11);
showT.append("\n ");
showT.append("实发工资:"+cha.s12);
showT.append("\n ");
showT.append("出 纳 员:"+"_______(签章)");
showT.append("\t\t本人签字:"+"__________");
}
}
//打印方法
else if(e.getSource()==b_print)
{T15.setText(null);
p=getToolkit().getPrintJob(this,"ok",null);
g=p.getGraphics();
g.translate(120,120);
showT.printAll(g);
g.dispose();
p.end();
}
//显示方法
else if(e.getSource()==b_show)
{ T15.setText(null);
showT.setText(null);
try{FileInputStream come_in53=new FileInputStream("zhigong1.txt");
ObjectInputStream in53 =new ObjectInputStream(come_in53);
list=(LinkedList)in53.readObject(); ////
}
catch(ClassNotFoundException event){}
catch(IOException event){}
Iterator iter=list.iterator();
while(iter.hasNext())
{ Wage te=(Wage)iter.next();
showT.append("代号:"+te.s1+" ");
showT.append("姓名:"+te.s2+" ");
showT.append("应发工资:"+te.s8+" ");
showT.append("实发工资:"+te.s12+" ");
showT.append("\n ");
}
}
//统计方法
else if(e.getSource()==b_tongji)
{ double s15=0;double tj;
try{FileInputStream come_in64=new FileInputStream("zhigong1.txt");
ObjectInputStream in64 =new ObjectInputStream(come_in64);
list=(LinkedList)in64.readObject(); ////从文件中读出对象
}
catch(ClassNotFoundException event){}
catch(IOException event){}
int number1=list.size();
for(int i=0;i<number1;i++)
{ Wage mov=(Wage)list.get(i);
tj=mov.s12;
s15=s15+tj;
}
T15.setText("本次所发工资总额:"+String.valueOf(s15));
}
//退出方法
else if(e.getSource()==b_back)
System.exit(0);
}
}
////////////////////////////////////////////////////////////////////////
class Worker_01 extends JFrame //implements ActionListener
{
public JFrame frame;
public Container c;
//public DefaultListModel philosophers;
public JList list;
//////////////////////////////////////////////
public Worker_01()
{
frame = new JFrame("职工工资管理系统");
c = frame.getContentPane();
c.setLayout(null);
frame.setResizable(false);
/////////////////////////////////////////////////
JLabel information0= new JLabel("欢迎进入职工工资管理系统",JLabel.CENTER);
information0.setFont(new Font("宋体",Font.BOLD,25));
information0.setSize(350,50);
information0.setLocation(0,0);
information0.setForeground(Color.red);
c.add(information0);
JLabel yonghuL= new JLabel("用户名:",JLabel.CENTER);
yonghuL.setFont(new Font("宋体",Font.BOLD,18));
yonghuL.setForeground(Color.red);
yonghuL.setSize(80,30);
yonghuL.setLocation(60,70);
c.add(yonghuL);
final TextField yonghuT=new TextField();
yonghuT.setSize(90,25);
yonghuT.setLocation(170,70);
c.add(yonghuT);
JLabel koulingL= new JLabel("口 令:",JLabel.CENTER);
koulingL.setFont(new Font("宋体",Font.BOLD,18));
koulingL.setForeground(Color.red);
koulingL.setSize(80,30);
koulingL.setLocation(60,110);
c.add(koulingL);
final TextField koulingT=new TextField();
koulingT.setEchoChar('*');
koulingT.setSize(90,25);
koulingT.setLocation(170,110);
c.add(koulingT);
JLabel information1= new JLabel("指导教师:张银霞");
information1.setFont(new Font("宋体",Font.BOLD,17));
information1.setForeground(Color.red);
information1.setSize(350,110);
information1.setLocation(100,140);
c.add(information1);
JLabel information2 = new JLabel("制作人:刘仪阳 ");
information2.setFont(new Font("宋体",Font.BOLD,14));
information2.setForeground(Color.red);
information2.setSize(350,110);
information2.setLocation(130,160);
c.add(information2);
JLabel information3 = new JLabel("");
information3.setFont(new Font("宋体",Font.BOLD,14));
information3.setForeground(Color.red);
information3.setSize(350,110);
information3.setLocation(190,180);
c.add(information3);
JLabel information4 = new JLabel("制作时间:2005-11");
information4.setFont(new Font("宋体",Font.BOLD,14));
information4.setForeground(Color.red);
information4.setSize(350,110);
information4.setLocation(115,200);
c.add(information4);
////////////////////////////////////////////////
JButton registerButton = new JButton( "登录" );
registerButton.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
{ String a,b;
a=yonghuT.getText();b=koulingT.getText();
if((a.equals("123")==true)&&(b.equals("123")==true))
{ z2 win=new z2();
win.setSize(500,400);
win.setVisible(true);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.setResizable(false);
win.setLocation(100,100);
}
else
JOptionPane.showMessageDialog(null,"对不起,你输入的信息错误!");
} });
registerButton.setLocation(40,150);
registerButton.setSize(80,30);
registerButton.setFont(new Font("宋体",Font.BOLD,18));
registerButton.setForeground(Color.red);
c.add(registerButton, BorderLayout.CENTER);
JButton backButton = new JButton( "退出" );
backButton.addActionListener( new ActionListener()
{ public void actionPerformed( ActionEvent event )
{
System.exit(0);
}
} );
backButton.setLocation(190,150);
backButton.setSize(80,30);
backButton.setFont(new Font("宋体",Font.BOLD,18));
backButton.setForeground(Color.red);
c.add(backButton, BorderLayout.CENTER);
////////////////////////////////////////////////
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(350,300);
frame.setLocation(100,100);
frame.setVisible(true);
}
}
public class Worker
{
public static void main(String []args)
{
new Worker_01();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -