Java编写的简单图书管理系统.docxVIP

  • 0
  • 0
  • 约1.19万字
  • 约 13页
  • 2023-05-12 发布于湖北
  • 举报
Java 编写的简单图书管理系统 主界面 代码实现 packageLibrary; importjava.awt.BorderLayout; importjava.awt.Color; importjava.awt.Container; importjava.awt.event.ActionEvent; importjava.awt.event.ActionListener; importjava.sql.Connection; importjava.sql.DriverManager; importjava.sql.ResultSet; importjava.sql.SQLException; importjava.sql.Statement; importjavax.swing.ImageIcon; importjavax.swing.JButton; importjavax.swing.JFrame; importjavax.swing.JLabel; importjavax.swing.JOptionPane; importjavax.swing.JPanel; importjavax.swing.JPasswordField; importjavax.swing.JTextField; publicclassLoginextendsJFrame{ privatestaticfinallongserialVersionUID=1L; privateJLabeljlUsername; privateJLabeljlPwd; privateJTextFieldtxtUsername;//用户名privateJTextFieldtxtPassword;//密码privateJButtonjbOk; privateJButtonjbCancel; publicJLabelgetJlUsername(){ if(jlUsername==null) { jlUsername=newJLabel( 账 号 ); jlUsername.setForeground(Color.BLACK); jlUsername.setBounds(118,40,85,30); } returnjlUsername; } publicJLabelgetJlPwd(){ if(jlPwd==null) { jlPwd=newJLabel( 密 码 ); jlPwd.setForeground(Color.BLACK); jlPwd.setBounds(118,100,85,30); } returnjlPwd; } publicJTextFieldgetTxtUsername(){ if(txtUsername==null) { txtUsername=newJTextField(20); txtUsername.setBounds(180,40,200,30); } returntxtUsername; } publicJTextFieldgetTxtPassword(){ if(txtPassword==null) { txtPassword=newJPasswordField(20); txtPassword.setBounds(180,100,200,30); } returntxtPassword; } publicJButtongetJbOk(){ if(jbOk==null) { jbOk=newJButton( 登 陆 ); jbOk.setBounds(150,180,90,30); //jbOk.addActionListener(this); } returnjbOk; } publicJButtongetJbCancel(){ if(jbCancel==null) { jbCancel=newJButton( 取 消 ); jbCancel.setBounds(300,180,90,30); } returnjbCancel; } publicLogin(Stringtitle) { super(title); //JFrameframe=newJFrame(); Containercantainer=this.getContentPane(); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIconimg=newImageIcon(F:\\Java\\ 传 习 \\src\\Library\\ZF`XY`H48I_}U)C4~}M2~C4.jpg);//这是背景图片JLabelimgLabel=newJLabel(img);//将背景图放在标签里。this.g

文档评论(0)

1亿VIP精品文档

相关文档