📄 zhuce.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 javax.swing.JOptionPane;
public class ZhuCe{
JFrame jfra;
JTextField jtf;
JPasswordField jpf;
JLabel jl;
Object[][] ob = null;
String[] str = {"用户编号","用户名","用户密码"};
public ZhuCe(){
jfra = new JFrame();
Container contpent = jfra.getContentPane();
contpent.setLayout(null);
Font f = new Font("新宋体",1,15);
Font f1 = new Font("幼圆",1,20);
jl = new JLabel("欢迎进入注册页面");
jl.setBounds(100,20,250,40);
jl.setForeground(Color.red);
jl.setFont(f1);
JLabel jl1 = new JLabel("用户名:");
jl1.setBounds(30,70,80,20);
jl1.setForeground(Color.blue);
jl1.setFont(f);
jtf = new JTextField(20);
jtf.setBounds(120,70,230,20);
jtf.setFont(f);
jtf.setForeground(Color.blue);
JLabel jl2 = new JLabel("密 码:");
jl2.setBounds(30,110,80,20);
jl2.setForeground(Color.blue);
jl2.setFont(f);
jpf = new JPasswordField(20);
jpf.setBounds(120,110,230,20);
jpf.setForeground(Color.blue);
jpf.setFont(f);
jpf.setEchoChar('*');
JButton jb = new JButton("确定");
jb.setBounds(80,150,70,30);
jb.setForeground(Color.blue);
jb.setFont(f);
JButton jb1 = new JButton("重置");
jb1.setBounds(170,150,70,30);
jb1.setForeground(Color.blue);
jb1.setFont(f);
JButton jb2 = new JButton("退后");
jb2.setBounds(260,150,70,30);
jb2.setForeground(Color.blue);
jb2.setFont(f);
ImageIcon image = new ImageIcon("e:\\大一项目\\产品销售管理系统\\button1.jpg");
contpent.add(jl);
contpent.add(jl1);
contpent.add(jtf);
contpent.add(jl2);
contpent.add(jpf);
contpent.add(jb);
contpent.add(jb1);
contpent.add(jb2);
//添加事件
jb.addActionListener(new queding());
jb1.addActionListener(new chongzhi());
jb2.addActionListener(new tuihou());
jfra.setIconImage(image.getImage());
jfra.setUndecorated(true);
jfra.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
jfra.setTitle("注册信息框");
jfra.setResizable(false);
jfra.setBounds(400,300,400,250);
jfra.setVisible(true);
}
//添加重置事件的按钮
private class chongzhi implements ActionListener{
public void actionPerformed(ActionEvent e){
jtf.setText("");
jpf.setText("");
jtf.grabFocus();
jl.setText("请重新输入相关内容");
}
}
//添加退后按钮事件
private class tuihou implements ActionListener{
public void actionPerformed(ActionEvent e){
DengLu dl = new DengLu();
jfra.setVisible(false);
jfra.disable();
}
}
//添加确定按扭事件
public class queding implements ActionListener{
public void actionPerformed(ActionEvent e){
int num = 0;
YongHuKu yk = new YongHuKu();
if(!jtf.getText().equals("") || !jpf.getText().equals("")){
num = yk.insert(jtf.getText(),jpf.getText());
}
// ob = new Object[yk.select().size()][3];
// for(int i = 0;i < ob.length;i++){
// ob[i][0] = yk.select().get(0);
// ob[i][1] = yk.select().get(1);
// ob[i][2] = yk.select().get(2);
// }
if(num > 0){
ZhuYao zy = new ZhuYao();
}
else{
JOptionPane.showMessageDialog(null,"连接数据库失败请重新填写");
ZhuCe zc = new ZhuCe();
}
jfra.setVisible(false);
jfra.disable();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -