📄 frame10.java~5~
字号:
package test1;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;/** * <p>Title: 图书管理系统</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: </p> * @author koma * @version 1.0 */public class Frame10 extends JFrame { JLabel jLabel1 = new JLabel(); JTextField jTextField1 = new JTextField(); JLabel jLabel2 = new JLabel(); JTextField jTextField2 = new JTextField(); JButton jButton1 = new JButton(); public Frame10() { this.setTitle("还书"); this.setSize(300,300); this.setLocation(450,250); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { jLabel1.setFont(new java.awt.Font("DialogInput", 0, 20)); jLabel1.setText("证件号"); jLabel1.setBounds(new Rectangle(19, 49, 104, 44)); this.getContentPane().setLayout(null); jTextField1.setFont(new java.awt.Font("DialogInput", 0, 20)); jTextField1.setText(""); jTextField1.setBounds(new Rectangle(146, 49, 228, 44)); jLabel2.setFont(new java.awt.Font("DialogInput", 0, 20)); jLabel2.setText("图书编号"); jLabel2.setBounds(new Rectangle(13, 126, 97, 44)); jTextField2.setFont(new java.awt.Font("DialogInput", 0, 20)); jTextField2.setText(""); jTextField2.setBounds(new Rectangle(148, 127, 229, 42)); jButton1.setBounds(new Rectangle(111, 214, 92, 44)); jButton1.setFont(new java.awt.Font("DialogInput", 0, 20)); jButton1.setText("确定"); jButton1.addActionListener(new Frame10_jButton1_actionAdapter(this)); this.getContentPane().add(jLabel1, null); this.getContentPane().add(jLabel2, null); this.getContentPane().add(jTextField2, null); this.getContentPane().add(jTextField1, null); this.getContentPane().add(jButton1, null); } void jButton1_actionPerformed(ActionEvent e) { String userNo=jTextField1.getText(); String bkNo=jTextField2.getText(); String bkBorrow="delete from userInfo where(证件号='"+userNo+"' and 图书编号='"+bkNo+"')"; PreparedStatement pst=Application1.pst1; //ResultSet rst1=Application1.rst1;// Application1.rst2=Application1.smt.executeQuery("select * from book"); // ResultSet rst2=Application1.rst2; boolean bl=true; try{ Statement smt=Application1.con.createStatement(); //Application1.rst2=Application1.smt.executeQuery("select * from book"); ResultSet rst2=Application1.smt.executeQuery("select * from book"); // ResultSet rst=Application1.smt.executeQuery("select * from user1");// while(rst1.next()) while(rst2.next()){ if (rst2.getString(1).equals(bkNo)){ System.out.println("koma"); smt.executeUpdate(bkBorrow); break; } } }catch(Exception e1){} }}class Frame10_jButton1_actionAdapter implements java.awt.event.ActionListener { Frame10 adaptee; Frame10_jButton1_actionAdapter(Frame10 adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jButton1_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -