package com.ucai.admin; import java.awt.Color; import java.awt.Container; import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.SQLException; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import com.ucai.callnum.CallNumUI; import com.ucai.jdbc.BankJdbc; import com.ucai.thread.Time; import com.ucai.tool.MySart; import com.ucai.tool.Set; public class AdminLoginUI { private JFrame frame; JTextField userField; JTextField passField; JButton djb; public AdminLoginUI() { frame = new JFrame("管理员登录"); Container c=new Container(); c=Set.setBack(frame, "image/login.jpg"); JLabel jl1 = new JLabel("管理员:", JLabel.CENTER); JLabel jl2 = new JLabel("密码:", JLabel.CENTER); JLabel jl3 = new JLabel("2017-9-9",JLabel.CENTER);//***********************时钟放置 Time time = new Time(jl3); time.start(); jl1.setBounds(500, 250, 110, 80); jl2.setBounds(500, 320, 120, 80); jl3.setBounds(80, 600, 400, 70); Font f = new Font("黑体", 1,24); jl1.setFont(f); jl2.setFont(f); jl3.setFont(f); jl1.setForeground(Color.white); jl2.setForeground(Color.white); jl3.setForeground(Color.RED); // 文本框 userField = new JTextField(10); userField.setBounds(640, 270, 200, 40); userField.setFont(new Font("黑体", 100, 18)); // 密码框 passField = new JTextField(10); passField.setBounds(640, 340, 200, 40); passField.setFont(new Font("黑体", 100, 18)); // 登录按钮 JButton exit = new JButton("退出"); djb=Set.setJButton(djb, "登 录", "", 470, 450, 200, 100); exit=Set.setJButton(exit,"退 出", "", 670, 450, 200, 100); c.add(jl1); c.add(jl2); c.add(jl3); c.add(userField); c.add(passField); c.add(djb); c.add(exit); MySart p=new MySart(); p.setBackground(Color.BLACK); p.setBounds(0, 50, 1980, 100); //将画布放到画板上 c.add(p); frame.setVisible(true); exit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); djb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if(userField.getText().equals("")||passField.getText().equals("")){ Toolkit toolkit=Toolkit.getDefaultToolkit(); toolkit.beep(); JOptionPane.showMessageDialog(frame, "账号或密码不能为空"); }else{ if(BankJdbc.admin1((String) userField.getText(), passField.getText())){ System.out.println("登录成功"); frame.dispose(); new AdminUI(); }else{ System.out.println("登陆失败"); Toolkit toolkit=Toolkit.getDefaultToolkit(); toolkit.beep(); JOptionPane.showMessageDialog(frame, "登录失败"); } } } catch (SQLException e1) { e1.printStackTrace(); } } }); } }
最近下载更多
caomin LV4
2023年5月25日
香菇肉饼汤 LV8
2023年4月13日
wangzitao LV11
2022年2月24日
17798830 LV14
2022年1月25日
一头土猪 LV7
2021年12月22日
孙纪龙啊 LV10
2021年12月8日
sssswwwwdddd LV1
2021年11月22日
YY杆杆 LV1
2021年7月21日
张鑫平 LV1
2021年7月3日
wanglinddad LV54
2021年6月27日
最近浏览更多
akittyboy LV9
3月22日
1049066887 LV12
3月3日
1134116035
2月28日
暂无贡献等级
fff2003 LV6
1月11日
求学的熊猫 LV6
2023年12月25日
hank0509 LV10
2023年12月19日
郑泽文
2023年8月1日
暂无贡献等级
limin123 LV6
2023年7月21日
z875152686 LV8
2023年6月28日
17683946472 LV9
2023年6月8日