📄 denglu.java
字号:
package deng.shaoxiao;
import xiao.xiaoshouxiaoshou.*;
import sun.BuMenXiaoShou.*;
import sn.ChangPingXiaoShou.*;
import yuan.xiaoshou.*;
import com.yonghuxiaoshou.*;
import cn.KeKuXiaoShao.*;
//登陆页面完成
import java.awt.*;
import javax.swing.*;
import java.sql.*;
import java.awt.event.*;
import java.util.ArrayList;
public class DengLu{
//部门表字段
JFrame jfr;
JTextField jtf ;
JPasswordField jtf1;
JLabel jl;
DengLu(){
jfr = new JFrame();
Container cont = jfr.getContentPane();
cont.setLayout(null);
JPanel jp = new JPanel();
jp.setLayout(new GridLayout(2,1));
jp.setBounds(10,50,330,120);
jp.setBorder(BorderFactory.createTitledBorder("管理员登陆"));
Font f = new Font("幼圆",1,15);
jl = new JLabel("欢迎进入员工管理系统");
jl.setFont(f);
jl.setForeground(Color.red);
jl.setBounds(80,20,270,20);
JLabel jl1 = new JLabel("用户名:");
jl1.setFont(f);
jl1.setForeground(Color.blue);
JPanel jp1 = new JPanel();
jtf = new JTextField(20);
jtf.setFont(f);
jtf.setForeground(Color.blue);
jp1.add(jl1,new FlowLayout(FlowLayout.CENTER));
jp1.add(jtf,new FlowLayout(FlowLayout.CENTER));
JLabel jl2 = new JLabel("密 码:");
jl2.setFont(f);
jl2.setForeground(Color.blue);
jtf1 = new JPasswordField(20);
jtf1.setFont(f);
jtf1.setEchoChar('*');
jtf1.setForeground(Color.blue);
JPanel jp2 = new JPanel();
jp2.add(jl2,new FlowLayout(FlowLayout.CENTER));
jp2.add(jtf1,new FlowLayout(FlowLayout.CENTER));
JButton jb = new JButton("确定");
jb.setForeground(Color.blue);
jb.setFont(f);
jb.setBounds(50,180,70,30);
JButton jb1 = new JButton("重置");
jb1.setForeground(Color.blue);
jb1.setFont(f);
jb1.setBounds(130,180,70,30);
JButton jb2 = new JButton("退出");
jb2.setForeground(Color.blue);
jb2.setFont(f);
jb2.setBounds(210,180,70,30);
cont.add(jl);
jp.add(jp1);
jp.add(jp2);
cont.add(jp);
cont.add(jb);
cont.add(jb1);
cont.add(jb2);
ImageIcon image = new ImageIcon("e:\\大一项目\\产品销售管理系统\\button1.jpg");
//对其进行绑定
jb.addActionListener(new action());
jb1.addActionListener(new action1());
jb2.addActionListener(new action2());
jfr.setTitle("欢迎登陆");
jfr.setBounds(400,300,350,250);
jfr.setIconImage(image.getImage());
//用来设置窗体前的文本格式
jfr.setUndecorated(true);
jfr.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
jfr.setVisible(true);
jfr.setResizable(false);
}
//定义一个添加的方法
//添加确定按钮的事件
//现在只有一个问题怎样把内容输出来
class action implements ActionListener{
public void actionPerformed(ActionEvent e){
YongHuKu yhk = new YongHuKu();
if((yhk.select().contains(jtf.getText())) && (yhk.select().contains(jtf1.getText()))){
ZhuYao zhy = new ZhuYao();
jfr.setVisible(false);
jfr.disable();
}
else{
QueDing qd = new QueDing();
}
jfr.setVisible(false);
jfr.disable();
}
}
//添加重置按钮事件
class action1 implements ActionListener{
public void actionPerformed(ActionEvent e){
jtf.setText("");
jtf1.setText("");
jtf.grabFocus();
jl.setText("请重新填入相关信息");
jl.setForeground(Color.yellow);
}
}
//添加退出按钮事件
class action2 extends WindowAdapter implements ActionListener{
public void actionPerformed(ActionEvent e){
jfr.setVisible(false);
jfr.disable();
}
public void windowClosing(WindowEvent e){
System.exit(1);
}
}
public static void main(String[] args){
DengLu dl = new DengLu();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -