Eclipse+Java+Swing实现学校教材管理系统

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

import javax.swing.UIManager;

import javax.swing.UnsupportedLookAndFeelException;

import org.jvnet.substance.skin.SubstanceCremeLookAndFeel;

public class Login extends JFrame implements WindowListener, ActionListener, KeyListener {

private static final long serialVersionUID = 1L;

private JPanel jContentPane = null;

private JButton jButton = null;

private JButton jButton1 = null;

private JLabel jLabel = null;

private JLabel jLabel1 = null;

private JLabel jLabel2 = null;

private JTextField jTextField = null;

private JPasswordField jPasswordField = null;

private Connection connection; // @jve:decl-index=0:

private Statement stmt;

private String username;

private int flag = 0;

/**

  • This is the default constructor

*/

public Login() {

super();

try {

UIManager.setLookAndFeel(new SubstanceCremeLookAndFeel());

} catch (UnsupportedLookAndFeelException e) {

// TODO 自动生成 catch 块

e.printStackTrace();

}

initialize();

Dimension screen = getToolkit().getScreenSize(); // 得到屏幕尺寸

// pack(); //窗口适应组件尺寸

setLocation((screen.width - getWidth()) / 2, (screen.height - getHeight()) / 2);// 使窗口出现在屏幕中间

this.setResizable(false);// 不可缩放~~

this.addWindowListener(this);

connection = DBUtil.getlink();

try {

stmt = connection.createStatement();

} catch (SQLException e) {

// TODO 自动生成 catch 块

e.printStackTrace();

} // 链接数据库

}

/**

  • This method initializes this

  • @return void

*/

private void initialize() {

// 登录窗口大小

this.setSize(500, 308);

this.setContentPane(getJContentPane());

this.setTitle(“欢迎登录教材管理系统”);

}

  • 12
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值