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

📄 eventframe.java

📁 这是一个关于信用卡的JAVA
💻 JAVA
字号:
package xinyongka;

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.awt.Font;

public class eventframe
    extends JFrame {
  XYLayout xYLayout1 = new XYLayout();
  JMenuBar jMenuBar1 = new JMenuBar();
  JMenu  jMenu1=new JMenu();
  JMenu jMenu2 = new JMenu();
  JMenu jMenu3 = new JMenu();
  JMenu jMenu4 = new JMenu();
  private String cardid;
  private String username;
  private ResultSet rs;
 private querypanel querypanel1;
 // private int leavemoney;

  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  public eventframe(String id) {
    try {
      cardid=id;
      jbInit();
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    try{
     String url = "jdbc:odbc:dbcard";
     Connection conn1 = DriverManager.getConnection(url, " ", " ");
     Statement stmt1 = conn1.createStatement();
     String querysql = "Select name ,leavemoney from queryview where CardID='" +cardid+"'";
     rs = stmt1.executeQuery(querysql);
     rs.next();
     username=rs.getString("Name");
     //leavemoney=rs.getInt("leavemoney");
    // JOptionPane.showMessageDialog(null,leavemoney);
   }catch(Exception e2){
     e2.printStackTrace();
   }


    getContentPane().setLayout(xYLayout1);
    this.setJMenuBar(jMenuBar1);
    this.setTitle("欢迎使用");
    jMenu1.addMouseListener(new eventframe_jMenu1_mouseAdapter(this));
    jMenu2.setText("存款");
    jMenu2.addMouseListener(new eventframe_jMenu2_mouseAdapter(this));
    jMenu3.setText("取款");
    jMenu3.addMouseListener(new eventframe_jMenu3_mouseAdapter(this));
    jMenu4.setText("帮助");
    jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 30));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("欢迎使用信用卡系统");
    jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("版权所有 侵权必究");
    jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 18));
    jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel3.setText("2007-5月");
    jMenu1.setText("查询");
    jMenuBar1.add(jMenu1);
    jMenuBar1.add(jMenu2);
    jMenuBar1.add(jMenu3);
    jMenuBar1.add(jMenu4);
    this.getContentPane().add(jLabel1, new XYConstraints(20, 45, 354, 44));
    this.getContentPane().add(jLabel3, new XYConstraints(73, 218, 243, 41));
    this.getContentPane().add(jLabel2, new XYConstraints(39, 120, 304, 45));
  }



  public void jMenu1_mouseClicked(MouseEvent e) {
    querypanel querypanel1=new querypanel(cardid,username,this);
    this.remove(this.getContentPane());
    this.setContentPane(querypanel1);
    this.setVisible(true);

  }

  public void jMenu2_mouseClicked(MouseEvent e) {
     savepanel savepanel1=new savepanel(cardid,username,this);
     this.remove(this.getContentPane());
     this.setContentPane(savepanel1);
     this.setVisible(true);

  }
  public  void toquery(){
   //返回到查询面板

    querypanel1=new querypanel(cardid,username,this);
    this.remove(this.getContentPane());
    this.setContentPane(querypanel1);
    this.setVisible(true);
  }

  public void jMenu3_mouseClicked(MouseEvent e) {
    getpanel getpanel1=new getpanel(cardid,username,this);
    this.remove(this.getContentPane());
    this.setContentPane(getpanel1);
    this.setVisible(true);

  }

}

class eventframe_jMenu3_mouseAdapter
    extends MouseAdapter {
  private eventframe adaptee;
  eventframe_jMenu3_mouseAdapter(eventframe adaptee) {
    this.adaptee = adaptee;
  }

  public void mouseClicked(MouseEvent e) {
    adaptee.jMenu3_mouseClicked(e);
  }
}

class eventframe_jMenu2_mouseAdapter
    extends MouseAdapter {
  private eventframe adaptee;
  eventframe_jMenu2_mouseAdapter(eventframe adaptee) {
    this.adaptee = adaptee;
  }

  public void mouseClicked(MouseEvent e) {
    adaptee.jMenu2_mouseClicked(e);
  }
}

class eventframe_jMenu1_mouseAdapter
    extends MouseAdapter {
  private eventframe adaptee;
  eventframe_jMenu1_mouseAdapter(eventframe adaptee) {
    this.adaptee = adaptee;
  }



  public void mouseClicked(MouseEvent e) {
    adaptee.jMenu1_mouseClicked(e);
  }


}

⌨️ 快捷键说明

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