⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frame1.java~8~

📁 一个图书馆管理系统
💻 JAVA~8~
字号:
package database;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.sql.*;

import javax.swing.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Frame1 extends JFrame implements Serializable {
    JPanel contentPane;
    JButton jButton1 = new JButton();
    JLabel jLabel1 = new JLabel();
    JPasswordField jPasswordField1 = new JPasswordField();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    ResultSet rset;
    Statement stmt;
    Connection con;
    public Frame1() {
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con = DriverManager.getConnection("jdbc:odbc:stu","login",
            "password");
            Statement stmt = con.createStatement();
            //setDefaultCloseOperation(EXIT_ON_CLOSE);
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
    /*Connection con = DriverManager.getConnection("jdbc:odbc:wombat","login",
            "password");
    Statement stmt = con.createStatement();*/


    /**
     * Component initialization.
     *
     * @throws java.lang.Exception
     */
    private void jbInit() throws Exception {
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(null);
        setSize(new Dimension(609, 487));
        setTitle("Frame Title");
        setSize(200,300);
        jButton1.setBackground(Color.black);
        jButton1.setBounds(new Rectangle(154, 230, 104, 45));
        jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
        jButton1.setText("确认");
        jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
        jLabel1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 20));
        jLabel1.setText("请输入密码");
        jLabel1.setBounds(new Rectangle(19, 122, 115, 37));
        jPasswordField1.setText("jPasswordField1");
        jPasswordField1.setBounds(new Rectangle(154, 119, 234, 40));
        jPasswordField1.addActionListener(new
                                          Frame1_jPasswordField1_actionAdapter(this));
        contentPane.setBackground(Color.lightGray);
        jLabel2.setFont(new java.awt.Font("黑体", Font.PLAIN, 12));
        jLabel2.setText("系统只限管理员登陆");
        jLabel2.setBounds(new Rectangle(14, 22, 116, 32));
        jLabel3.setFont(new java.awt.Font("黑体", Font.PLAIN, 12));
        jLabel3.setText("登陆密码错误3次将退出");
        jLabel3.setBounds(new Rectangle(14, 51, 135, 28));
        contentPane.add(jPasswordField1);
        contentPane.add(jButton1);
        contentPane.add(jLabel1);
        contentPane.add(jLabel2);
        contentPane.add(jLabel3);
    }

    public void jButton1_actionPerformed(ActionEvent e) {
        //if(jPasswordField1.getPassword()){}
    }

    public void jPasswordField1_actionPerformed(ActionEvent e) {
        jPasswordField1.getPassword();
    }

    private void readObject(ObjectInputStream ois) throws IOException,
            ClassNotFoundException {
        ois.defaultReadObject();
    }

    private void writeObject(ObjectOutputStream oos) throws IOException {
        oos.defaultWriteObject();
    }
}


class Frame1_jPasswordField1_actionAdapter implements ActionListener {
    private Frame1 adaptee;
    Frame1_jPasswordField1_actionAdapter(Frame1 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jPasswordField1_actionPerformed(e);
    }
}


class Frame1_jButton1_actionAdapter implements ActionListener {
    private Frame1 adaptee;
    Frame1_jButton1_actionAdapter(Frame1 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -