📄 input.java
字号:
//package library2;import java.awt.BorderLayout;import javax.swing.JFrame;import javax.swing.JLabel;import java.awt.*;import javax.swing.JButton;import javax.swing.JTextField;import javax.swing.JCheckBox;import javax.swing.JTextArea;import javax.swing.JToggleButton;import java.io.*;import java.text.*;import java.awt.event.*;import java.awt.*;import javax.swing.*;/** * <p>Title: </p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2005</p> * * <p>Company: </p> * * @author not attributable * @version 1.0 */ public class input extends JFrame implements ActionListener{ JLabel jLabel1 = new JLabel(); JTextField jTextField1 = new JTextField(); JLabel jLabel2 = new JLabel(); JTextField jTextField2 = new JTextField(); JButton 注册 = new JButton(); JButton 登陆 = new JButton(); JButton 删除 = new JButton(); JButton 退出 = new JButton(); public input() { try { jbInit(); } catch (Exception exception) { exception.printStackTrace(); } } private void jbInit() throws Exception { setTitle("英语一百"); getContentPane().setLayout(null); setSize(500,350); jLabel1.setText("用户名:"); jLabel1.setBounds(new Rectangle(29, 26, 81, 31)); 退出.setBounds(new Rectangle(356, 249, 79, 33)); 退出.setText("退出");退出.addActionListener(this); 删除.setBounds(new Rectangle(219, 165, 82, 32)); 删除.setText("删除");删除.addActionListener(this); 登陆.setBounds(new Rectangle(115, 165, 74, 30)); 登陆.setText("登陆");登陆.addActionListener(this); 注册.setBounds(new Rectangle(25, 165, 68, 29)); 注册.setText("注册");注册.addActionListener(this); jTextField2.setText(""); jTextField2.setBounds(new Rectangle(131, 87, 108, 31)); jLabel2.setText("密 码:"); jLabel2.setBounds(new Rectangle(27, 91, 84, 30)); jTextField1.setText(""); jTextField1.setBounds(new Rectangle(130, 24, 108, 29)); this.getContentPane().add(jTextField1); this.getContentPane().add(jTextField2); this.getContentPane().add(注册); this.getContentPane().add(登陆); this.getContentPane().add(删除); this.getContentPane().add(jLabel1); this.getContentPane().add(jLabel2); this.getContentPane().add(退出); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) throws IOException { input input_object = new input(); } public void actionPerformed(ActionEvent e) { custom.custom_name = jTextField1.getText(); custom.custom_id = jTextField2.getText(); if(e.getActionCommand().equals("注册")) { custom.register(custom.custom_name, custom.custom_id); jTextField1.setText(""); jTextField2.setText(""); JOptionPane.showMessageDialog(null, "注册成功!", "output", JOptionPane.PLAIN_MESSAGE); } else if(e.getActionCommand().equals("登陆")) { if(custom.y_n_custom(custom.custom_name, custom.custom_id)) { setVisible(false); choose choose_object = new choose(); } else { jTextField1.setText(""); jTextField2.setText(""); JOptionPane.showMessageDialog(null, "用户名/密码错误!", "output", JOptionPane.PLAIN_MESSAGE); } } else if(e.getActionCommand().equals("删除")) { jTextField1.setText(""); jTextField2.setText(""); lose lose_object = new lose(); } else if(e.getActionCommand().equals("退出")) { System.exit(0); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -