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

📄 浏览日志.java

📁 学生信息管理系统(JBuilder x 开发,采用RSA 512位公钥加密,私钥用于找回密码,2006-4-5)
💻 JAVA
字号:
package untitled3;

import java.awt.*;
import javax.swing.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dbswing.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.JDialog;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2001</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class 浏览日志 extends JDialog {
  Database database1 = new Database();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  JPanel jPanel1 = new JPanel();
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();
  TableScrollPane tableScrollPane1 = new TableScrollPane();
  JdbTable jdbTable1 = new JdbTable();
  JButton jButton3 = new JButton();
  private int counter=0;
  Connection connection = null;                                // 声明Connection接口对象connection
  Statement statement = null;


  public 浏览日志(Frame frame, String title, boolean modal) {
    super(frame, title, modal);
    try {
      jbInit();
      pack();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  public 浏览日志() {
    this(null, "", false);
  }



  private void jbInit() throws Exception {
    this.getContentPane().setLayout(null);
    database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:日志管理", "", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
    jPanel1.setBounds(new Rectangle(286, 2, 170, 108));
    jButton1.setFont(new java.awt.Font("Dialog", 0, 15));
    jButton1.setMaximumSize(new Dimension(120, 30));
    jButton1.setPreferredSize(new Dimension(120, 30));
    jButton1.setText("查看");
    jButton1.addActionListener(new 浏览日志_jButton1_actionAdapter(this));
    jButton2.setFont(new java.awt.Font("Dialog", 0, 15));
    jButton2.setMaximumSize(new Dimension(120, 30));
    jButton2.setPreferredSize(new Dimension(120, 30));
    jButton2.setText("清空");
    jButton2.addActionListener(new 浏览日志_jButton2_actionAdapter(this));
    jdbNavToolBar1.setBounds(new Rectangle(44, 126, 427, 33));
    tableScrollPane1.setFont(new java.awt.Font("Dialog", 0, 15));
    tableScrollPane1.setBounds(new Rectangle(36, 161, 469, 213));
    jdbTable1.setFont(new java.awt.Font("Dialog", 0, 15));

    jButton3.setFont(new java.awt.Font("Dialog", 0, 15));
    jButton3.setMaximumSize(new Dimension(120, 30));
    jButton3.setPreferredSize(new Dimension(120, 30));
    jButton3.setMargin(new Insets(2, 14, 2, 14));
    jButton3.setText("返回");
    jButton3.addActionListener(new 浏览日志_jButton3_actionAdapter(this));
    jPanel1.add(jButton1, null);
    jPanel1.add(jButton2, null);
    jPanel1.add(jButton3, null);
    this.getContentPane().add(tableScrollPane1, null);

    this.getContentPane().add(jdbNavToolBar1, null);
    this.getContentPane().add(jPanel1, null);
  }


  void jButton1_actionPerformed(ActionEvent e) {
    if(counter==0){queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select * from 日志管理", null, true, Load.ALL));
      counter++;}
    else {queryDataSet1.close();
      queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select * from 日志管理", null, true, Load.ALL));
    }
      jdbTable1.setDataSet(queryDataSet1);
      tableScrollPane1.getViewport().add(jdbTable1, null);
   }
   void cancel() {
               dispose();
        }
  void jButton3_actionPerformed(ActionEvent e) {
        if (e.getSource() == jButton3) {
            cancel();
          }

  }

  void jButton2_actionPerformed(ActionEvent e) throws SQLException {
String sql="";
sql="delete from 日志管理";

   if(counter==0){queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, sql, null, true, Load.ALL));
   counter++;}
    else {queryDataSet1.close();
         queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, sql, null, true, Load.ALL));
      }

try{queryDataSet1.executeQuery();}catch(Exception ex){ JOptionPane.showMessageDialog(this,"日志数据已清空!","日志状态",JOptionPane.INFORMATION_MESSAGE);


}
}




class 浏览日志_jButton1_actionAdapter implements java.awt.event.ActionListener {
  浏览日志 adaptee;

  浏览日志_jButton1_actionAdapter(浏览日志 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class 浏览日志_jButton3_actionAdapter implements java.awt.event.ActionListener {
  浏览日志 adaptee;

  浏览日志_jButton3_actionAdapter(浏览日志 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton3_actionPerformed(e);
  }
}

class 浏览日志_jButton2_actionAdapter implements java.awt.event.ActionListener {
  浏览日志 adaptee;

  浏览日志_jButton2_actionAdapter(浏览日志 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
        try {
          adaptee.jButton2_actionPerformed(e);
        }
        catch (SQLException ex) {
        }
 //   adaptee.jButton2_actionPerformed(e);

  }
}
}

⌨️ 快捷键说明

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