• 我也不知道叫什么


    太晚了,来不及写知识点了,一切都在代码中

    package com.cqvie;

    import java.awt.BorderLayout;
    import java.awt.EventQueue;

    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.border.EmptyBorder;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JPasswordField;//一大堆看不懂的包含文件

    public class yang extends JFrame {

     private JPanel contentPane;
     private JTextField txt1;
     private JButton btnOk;
     private JButton btnNo;
     private JPasswordField txt2;//全是那些乱七八糟的方框的名字

     /**
      * Launch the application.
      */
     public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
       public void run() {
        try {
         yang frame = new yang();
         frame.setVisible(true);
        } catch (Exception e) {
         e.printStackTrace();
        }
       }
      });//这是内部类?反正我现在还不懂,它自己生出来的
     }

     /**
      * Create the frame.
      */
     public yang() {//这一个函数全是那些方框什么的
      setTitle("\u7528\u6237");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 450, 300);
      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);
      
      btnOk = new JButton("ok");
      btnOk.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent arg0) {
       }
      });
      btnOk.addMouseListener(new MouseAdapter() {//实现鼠标什么的......
       @Override
       public void mouseClicked(MouseEvent e) {
        String useName=txt1.getText();
        String password=txt2.getText();
        if(useName.equals("abc")&& (password.equals("123"))){
         btnOk.setText("登陆中.....");
            btnNo.setText("点我取消");
           
        }
        else if (useName.equals("abc")&& (!password.equals("123"))){
         btnOk.setText("密码错误...");
            btnNo.setText("点我取消");
        }
        else if (!useName.equals("abc")){
         btnOk.setText("不存在该用户...");
            btnNo.setText("点我取消");
        }
        else {
         btnOk.setText("密码错误");
            btnNo.setText("不开心");//判断输入的用户名和密码是否正确
            //     this.useNameTxt.setText("");
         //String useName=this.userNameTxt.getText();
        }
       }
      });
    //  btnOk.addMouseListener(new MouseAdapter() {
    //   @Override
    //   public void mouseClicked(MouseEvent arg0) {
    //    btnOk.setText("不要点我");
    //    btnNo.setText("点我");
    //   }
    //  });//这纯属好玩儿  嘿嘿
      btnOk.setBounds(149, 157, 93, 23);
      contentPane.add(btnOk);
      
      btnNo = new JButton("no");

      btnNo.addMouseListener(new MouseAdapter() {
       @Override
       public void mouseClicked(MouseEvent e) {
    //    btnNo.setText("哎哟");
    //    btnOk.setText("哈哈哈");
        
    //    String useName=txt1.getText();
    //    String passWord=txt2.getText();
        txt1.setText("");
        txt2.setText("");//清空那两个文本框(自学的哟   哈哈哈)
       
       }
      });
      btnNo.setBounds(149, 201, 93, 23);
      contentPane.add(btnNo);
      
      JLabel lblUserName = new JLabel("\u7528\u6237\u540D\uFF1A");
      lblUserName.setBounds(66, 43, 54, 15);
      contentPane.add(lblUserName);
      
      JLabel lblPassWord = new JLabel("  \u5BC6\u7801\uFF1A");
      lblPassWord.setBounds(66, 93, 54, 15);
      contentPane.add(lblPassWord);
      
      txt1 = new JTextField();
      txt1.addMouseListener(new MouseAdapter() {
       @Override
       public void mouseClicked(MouseEvent e) {
       }
      });
      txt1.setBounds(140, 38, 168, 21);
      contentPane.add(txt1);
      txt1.setColumns(10);
      
      txt2 = new JPasswordField();
      txt2.setBounds(140, 89, 168, 23);
      contentPane.add(txt2);//看不了,这些,无法翻译
     }
    }

    架构那个,昨天忘写了,好像都忘记了,明天再写不,好想把视频看完再回寝室啊~~~好不容易这么有感觉,时间不允许咯~~

  • 相关阅读:
    bobojquery筛选数组之grep、each、inArray、map的用法及遍历json对象 [转]
    bobojquery遍历json键值对
    python安装与初始
    Lambda表达式
    静态代理模式
    多线程
    java日期时间
    Git安装
    Node.js环境安装
    Maven的使用
  • 原文地址:https://www.cnblogs.com/jinhong/p/5589249.html
Copyright © 2020-2023  润新知