首页技术文章正文

注册页面【黑马区块链培训】

更新时间:2019年08月01日 19时21分34秒 来源:黑马程序员

黑马中级程序员课程

package Client; //看到背景图后不能看到jlabel的标签 import java.awt.Color; import java.awt.Container; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import DB.UserDB; public class Register extends JFrame { private static final long serialVersionUID = 1L; private JTextField userName; // 用户名 private JPasswordField password; // 密码 private JPasswordField password2; // 密码 private JLabel lableUser; private JLabel lablePwd; private JLabel lablePwd2; private JButton btnRegister; public Register() { BackgroundPanel background = new BackgroundPanel((new ImageIcon("image/bg.jpg")).getImage()); // new ImageIcon(""); background.setBounds(0, 0, 500, 500); // JLabel label = new JLabel(background);// 把背景图片显示在标签里 // label.setBounds(0, 0, background.getIconWidth(), // background.getIconHeight());// 把标签的大小位置设置为图片刚好填充整个面板 // System.out.println(background.getIconWidth()); // this.getLayeredPane().setLayout(null); // // 把背景图片添加到分层窗格的最底层作为背景 // this.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE)); // this.setSize(background.getIconWidth(), background.getIconHeight()); // this.setLocationRelativeTo(null);// 居中显示 // this.setAlwaysOnTop(true);// 顶层显示 // this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // // 创建一个容器 Container con = this.getContentPane(); con.add(background); // // 用户号码登录输入框 userName = new JTextField(); userName.setBounds(200, 50, 250, 40); userName.setFont(new Font("宋体", Font.BOLD, 20)); // 登录输入框旁边的文字 lableUser = new JLabel("填写用户名"); lableUser.setBounds(80, 50, 150, 40); lableUser.setFont(new Font("宋体", Font.BOLD, 20)); // 密码输入框 password = new JPasswordField(); password.setBounds(200, 100, 250, 40); password.setFont(new Font("宋体", Font.BOLD, 20)); password2 = new JPasswordField(); password2.setBounds(200, 150, 250, 40); password2.setFont(new Font("宋体", Font.BOLD, 20)); // 密码输入框旁边的文字 lablePwd = new JLabel("填写密码"); lablePwd.setBounds(100, 100, 100, 40); lablePwd.setFont(new Font("宋体", Font.BOLD, 20)); lablePwd2 = new JLabel("重填密码"); lablePwd2.setBounds(100, 150, 100, 40); lablePwd2.setFont(new Font("宋体", Font.BOLD, 20)); lablePwd = new JLabel("密码"); lablePwd.setBounds(200, 190, 50, 40); lablePwd.setFont(new Font("宋体", Font.BOLD, 20)); lablePwd.setForeground(Color.RED); // 注册按钮 btnRegister = new JButton("注册"); btnRegister.setBounds(200, 220, 150, 50); btnRegister.setFont(new Font("宋体", Font.BOLD, 20)); btnRegister.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String name = userName.getText(); String pwd1 = String.valueOf(password.getPassword()); String pwd2 = String.valueOf(password2.getPassword()); registerUser(name, pwd1, pwd2); } }); // 所有组件用容器装载 con.add(lableUser); con.add(lablePwd); con.add(lablePwd2); con.add(userName); con.add(password); con.add(password2); con.add(btnRegister); this.setTitle("Register Hello");// 设置窗口标题 this.setLayout(null);// 设置布局方式为绝对定位 this.setBounds(0, 0, 550, 350); Image image = new ImageIcon("image/icon.png").getImage(); this.setIconImage(image);// 设置窗体的标题图标 this.setResizable(false);// 窗体大小不能改变 this.setLocationRelativeTo(null);// 居中显示 this.setVisible(true);// 窗体可见 this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } // 注册方法 private void registerUser(String name, String pwd1, String pwd2) { if (pwd1.equals(pwd2)) { UserDB c = new UserDB(name, pwd2); if (c.addsql() == true) { JOptionPane.showMessageDialog(new JFrame(), "注册成功!\n请记住您的账号和密码", "恭喜", JOptionPane.CLOSED_OPTION); } else { JOptionPane.showMessageDialog(new JFrame(), "注册失败,换个用户名试试吧!", "错误", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(new JFrame(), "两次输入密码不相同!", "错误", JOptionPane.ERROR_MESSAGE); password.setText(""); password2.setText(""); } } class BackgroundPanel extends JPanel { Image im; public BackgroundPanel(Image im) { this.im = im; this.setOpaque(true); } // Draw the back ground. public void paintComponent(Graphics g) { super.paintComponents(g); g.drawImage(im, 0, 0, this.getWidth(), this.getHeight(), this); } } } --------------------- 作者:不折腾就闹心 来源:CSDN 原文:https://blog.csdn.net/DDFFR/article/details/79727335

初级程序员与中级程程序员的差距

现有的IT培训机构通常是4至6个月的课程培养初级程序员,而初级程序员与中级程序员的差别,就在于后者比前者多了3-4年工作经验,每年会接触1-2个项目,中级程序员比初级程序员多了相关的行业经验和项目经验。

 

企业需要中级及以上程序员

IT行业技术不断发展,IT行业用人单位对人才的要求越来越高,IT培训机构4—6个月的课程产品要培养出企业需要的人才越来越难。

 

中级程序员课程

传智播客已经进行了课程产品升级,将定位中级程序员培养。推出多领域实战项目课程,将课程时长延长至9至12个月,采用线上和线下混合式教学,布局中级程序员人才培养,学费不变。传智播客还公布了43个主流行业项目,涉及Java、大数据、Python、PHP和前端等5个技术领域。【点击页面咨询按钮,了解中级程序员课程】

推荐了解热门学科

java培训 Python人工智能 Web前端培训 PHP培训
区块链培训 影视制作培训 C++培训 产品经理培训
UI设计培训 新媒体培训 软件测试培训 Linux运维
大数据培训 智能机器人软件开发


黑马程序员热门视频教程

Python入门教程完整版(懂中文就能学会) 零起点打开Java世界的大门
C++| 匠心之作 从0到1入门学编程 PHP|零基础入门开发者编程核心技术
Web前端入门教程_Web前端html+css+JavaScript 软件测试入门到精通


在线咨询 我要报名
和我们在线交谈!