?? borrowhistorybystudentname.java~8~
字號:
package bookmanager;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.*;import java.sql.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class borrowHistoryBystudentname extends JFrame { ResultSet rs; //resultset String sql; private DBManager db =new DBManager(); XYLayout xYLayout1 = new XYLayout(); JLabel jLabel4 = new JLabel(); JLabel jLabel1 = new JLabel(); JLabel jLabel3 = new JLabel(); JTextField jTextbdate = new JTextField(); JButton jButtonnext = new JButton(); JButton jButtonpre = new JButton(); JButton jButtonlast = new JButton(); JButton jButtonupdate = new JButton(); JLabel jLabel2 = new JLabel(); JTextField jTextbname = new JTextField(); JButton jButtonexit = new JButton(); JButton jButtondelete = new JButton(); JButton jButtonsearch = new JButton(); JButton jButtonfirst = new JButton(); JTextField jTextpname = new JTextField(); JTextField jTextrdate = new JTextField(); JTextField jTextcomment = new JTextField(); JLabel jLabel5 = new JLabel(); JPanel jPanel1 = new JPanel(); XYLayout xYLayout2 = new XYLayout(); public borrowHistoryBystudentname() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) { borrowHistoryBystudentname borrowHistoryBystudentname = new borrowHistoryBystudentname(); } private void jbInit() throws Exception { jLabel5.setText("還閱日期"); jLabel5.setFont(new java.awt.Font("Dialog", 0, 16)); jTextcomment.setText(""); jTextcomment.setFont(new java.awt.Font("Dialog", 0, 16)); jTextrdate.setText(""); jTextrdate.setFont(new java.awt.Font("Dialog", 0, 16)); jTextpname.setText(""); jTextpname.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonfirst.setText("第一條"); jButtonfirst.addMouseListener(new borrowHistoryBystudentname_jButtonfirst_mouseAdapter(this)); jButtonfirst.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonsearch.setText("查詢"); jButtonsearch.setFont(new java.awt.Font("Dialog", 0, 16)); jButtondelete.setFont(new java.awt.Font("Dialog", 0, 16)); jButtondelete.setText("刪除"); jButtondelete.addMouseListener(new borrowHistoryBystudentname_jButtondelete_mouseAdapter(this)); jButtonexit.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonexit.setText("退出"); jButtonexit.addMouseListener(new borrowHistoryBystudentname_jButtonexit_mouseAdapter(this)); jTextbname.setText(""); jTextbname.setFont(new java.awt.Font("Dialog", 0, 16)); jLabel2.setText("書名"); jLabel2.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonupdate.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonupdate.setText("更新"); jButtonupdate.addMouseListener(new borrowHistoryBystudentname_jButtonupdate_mouseAdapter(this)); jButtonlast.setText("最后一條"); jButtonlast.addMouseListener(new borrowHistoryBystudentname_jButtonlast_mouseAdapter(this)); jButtonlast.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonpre.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonpre.setText("前一條"); jButtonpre.addMouseListener(new borrowHistoryBystudentname_jButtonpre_mouseAdapter(this)); jButtonnext.setFont(new java.awt.Font("Dialog", 0, 16)); jButtonnext.setText("后一條"); jButtonnext.addMouseListener(new borrowHistoryBystudentname_jButtonnext_mouseAdapter(this)); jTextbdate.setText(""); jTextbdate.setFont(new java.awt.Font("Dialog", 0, 16)); jLabel3.setText("借閱日起"); jLabel3.setFont(new java.awt.Font("Dialog", 0, 16)); jLabel1.setText("借閱者姓名"); jLabel1.setFont(new java.awt.Font("Dialog", 0, 16)); jLabel4.setText("備注"); jLabel4.setFont(new java.awt.Font("Dialog", 0, 16)); this.getContentPane().setLayout(xYLayout1); xYLayout1.setWidth(656); xYLayout1.setHeight(395); jPanel1.setLayout(xYLayout2); jPanel1.setBorder(BorderFactory.createLineBorder(Color.black)); this.addMouseListener(new borrowHistoryBystudentname_this_mouseAdapter(this)); this.getContentPane().add(jButtonsearch, new XYConstraints(441, 35, 104, 31)); this.getContentPane().add(jPanel1, new XYConstraints(26, 88, 611, 229)); jPanel1.add(jTextbname, new XYConstraints(220, 29, 154, 23)); jPanel1.add(jTextrdate, new XYConstraints(221, 118, 137, -1)); jPanel1.add(jLabel4, new XYConstraints(65, 178, 66, 29)); jPanel1.add(jLabel3, new XYConstraints(67, 71, 87, 29)); jPanel1.add(jTextbdate, new XYConstraints(220, 72, 137, -1)); jPanel1.add(jLabel2, new XYConstraints(69, 14, 89, 35)); jPanel1.add(jTextcomment, new XYConstraints(219, 171, 324, -1)); jPanel1.add(jLabel5, new XYConstraints(64, 119, 87, 29)); this.getContentPane().add(jButtonnext, new XYConstraints(202, 346, 89, 26)); this.getContentPane().add(jButtonpre, new XYConstraints(119, 345, 82, 26)); this.getContentPane().add(jButtonlast, new XYConstraints(291, 346, 98, 27)); this.getContentPane().add(jButtonupdate, new XYConstraints(390, 347, 84, 27)); this.getContentPane().add(jButtonexit, new XYConstraints(559, 346, 70, 28)); this.getContentPane().add(jButtondelete, new XYConstraints(473, 347, 86, 28)); this.getContentPane().add(jButtonfirst, new XYConstraints(32, 344, 86, 26)); this.getContentPane().add(jTextpname, new XYConstraints(246, 42, 116, 26)); this.getContentPane().add(jLabel1, new XYConstraints(92, 39, 88, 33)); } void showResult(){ try { jTextpname.setText(rs.getString("studentname") ); jTextbname.setText(rs.getString("bookname") ); jTextbdate.setText(rs.getString("borrowdate") ); jTextrdate.setText(rs.getString("returndate") ); jTextcomment.setText(rs.getString("comment") ); } catch (SQLException ex) { } } void this_mouseClicked(MouseEvent e) { sql="select * from BookBorrow "; // JOptionPane.showMessageDialog(null,jCombocolor.getSelectedItem().toString().trim() ); if (jTextpname.getText().trim().length() ==0) {} else { sql=sql+" where studentname='"+jTextpname.getText().trim()+"'"; } rs =db.getResult(sql); try { if(! rs.equals(null) ) { rs.next(); showResult(); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null," search failed!"); } } void jButtonfirst_mouseClicked(MouseEvent e) { } void jButtonpre_mouseClicked(MouseEvent e) { } void jButtonnext_mouseClicked(MouseEvent e) { } void jButtonlast_mouseClicked(MouseEvent e) { } void jButtonupdate_mouseClicked(MouseEvent e) { } void jButtondelete_mouseClicked(MouseEvent e) { } void jButtonexit_mouseClicked(MouseEvent e) { dispose(); }}class borrowHistoryBystudentname_this_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_this_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.this_mouseClicked(e); }}class borrowHistoryBystudentname_jButtonfirst_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtonfirst_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtonfirst_mouseClicked(e); }}class borrowHistoryBystudentname_jButtonpre_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtonpre_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtonpre_mouseClicked(e); }}class borrowHistoryBystudentname_jButtonnext_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtonnext_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtonnext_mouseClicked(e); }}class borrowHistoryBystudentname_jButtonlast_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtonlast_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtonlast_mouseClicked(e); }}class borrowHistoryBystudentname_jButtonupdate_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtonupdate_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtonupdate_mouseClicked(e); }}class borrowHistoryBystudentname_jButtondelete_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtondelete_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtondelete_mouseClicked(e); }}class borrowHistoryBystudentname_jButtonexit_mouseAdapter extends java.awt.event.MouseAdapter { borrowHistoryBystudentname adaptee; borrowHistoryBystudentname_jButtonexit_mouseAdapter(borrowHistoryBystudentname adaptee) { this.adaptee = adaptee; } public void mouseClicked(MouseEvent e) { adaptee.jButtonexit_mouseClicked(e); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -