?? zhujiemian.java~31~
字號:
package MainFrame;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.Color;
import javax.swing.JPasswordField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import DataBaseManager.DataBaseManager;
import java.sql.ResultSet;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
public class ZhuJieMian extends JFrame {
XYLayout xYLayout1 = new XYLayout();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JPasswordField jPasswordField1 = new JPasswordField();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
public ZhuJieMian() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(xYLayout1);
jLabel1.setFont(new java.awt.Font("華文彩云", Font.BOLD, 25));
jLabel1.setForeground(Color.green);
jLabel1.setText("操作主界面");
jLabel3.setFont(new java.awt.Font("宋體", Font.BOLD, 15));
jLabel3.setForeground(Color.red);
jLabel3.setText("請再次輸入密碼");
jLabel2.setFont(new java.awt.Font("宋體", Font.BOLD, 15));
jLabel2.setForeground(Color.red);
jLabel2.setText("為了您的操作成功");
this.addWindowListener(new ZhuJieMian_this_windowAdapter(this));
jButton1.setFont(new java.awt.Font("宋體", Font.BOLD, 15));
jButton1.setText("查詢餘額");
jButton1.addActionListener(new ZhuJieMian_jButton1_actionAdapter(this));
xYLayout1.setWidth(402);
xYLayout1.setHeight(354);
jButton3.setFont(new java.awt.Font("宋體", Font.BOLD, 15));
jButton3.setText("轉帳");
jButton3.addActionListener(new ZhuJieMian_jButton3_actionAdapter(this));
jButton4.setFont(new java.awt.Font("宋體", Font.BOLD, 15));
jButton4.setText("取消");
jButton4.addActionListener(new ZhuJieMian_jButton4_actionAdapter(this));
jButton2.setFont(new java.awt.Font("宋體", Font.BOLD, 15));
jButton2.setText("取款");
jButton2.addActionListener(new ZhuJieMian_jButton2_actionAdapter(this));
this.getContentPane().add(jLabel2, new XYConstraints(76, 83, 170, 39));
this.getContentPane().add(jLabel3, new XYConstraints(76, 131, 152, 32));
this.getContentPane().add(jPasswordField1,
new XYConstraints(74, 199, 143, 37));
this.getContentPane().add(jButton1, new XYConstraints(290, 80, 100, 50));
this.getContentPane().add(jButton3, new XYConstraints(290, 200, 100, 50));
this.getContentPane().add(jButton2, new XYConstraints(290, 140, 100, 50));
this.getContentPane().add(jButton4, new XYConstraints(290, 260, 100, 50));
this.getContentPane().add(jLabel1, new XYConstraints(142, 10, 171, 44));
}
public static void main(String[] args) {
ZhuJieMian z = new ZhuJieMian();
z.setBounds(200,200,400,400);
z.setVisible(true);
}
public void jButton1_actionPerformed(ActionEvent e) {
try { char a[]=jPasswordField1.getPassword();
String c=new String(a);
if(a.length==0){
JOptionPane.showMessageDialog(null,"沒有輸入密碼!","輸入錯誤",JOptionPane.ERROR_MESSAGE);
}
else {ResultSet rs;
DataBaseManager dbm=new DataBaseManager();
dbm.connect();
String sql="select * from YH where userpassword='"+ c+"'";
rs=dbm.getResult(sql);
if(rs.next()){
//this.dispose();
String d=rs.getString(3);
String d1=rs.getString(4);
JOptionPane.showMessageDialog(null,d+"先生 您還剩下 "+d1+"元","查詢信息",JOptionPane.ERROR_MESSAGE);}
jPasswordField1.setText("");
}
} catch (Exception ex) {
}
}
public void this_windowClosing(WindowEvent e) {
System.exit(0);
}
public void jButton4_actionPerformed(ActionEvent e) {
HuanYing h = new HuanYing();
h.setBounds(200,200,400,400);
h.setVisible(true);
}
public void jButton2_actionPerformed(ActionEvent e) {
QuKuan q = new QuKuan();
q.setBounds(200,200,400,400);
q.setVisible(true);
}
public void jButton3_actionPerformed(ActionEvent e) {
}
}
class ZhuJieMian_jButton3_actionAdapter implements ActionListener {
private ZhuJieMian adaptee;
ZhuJieMian_jButton3_actionAdapter(ZhuJieMian adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class ZhuJieMian_jButton2_actionAdapter implements ActionListener {
private ZhuJieMian adaptee;
ZhuJieMian_jButton2_actionAdapter(ZhuJieMian adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class ZhuJieMian_jButton4_actionAdapter implements ActionListener {
private ZhuJieMian adaptee;
ZhuJieMian_jButton4_actionAdapter(ZhuJieMian adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
class ZhuJieMian_jButton1_actionAdapter implements ActionListener {
private ZhuJieMian adaptee;
ZhuJieMian_jButton1_actionAdapter(ZhuJieMian adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class ZhuJieMian_this_windowAdapter extends WindowAdapter {
private ZhuJieMian adaptee;
ZhuJieMian_this_windowAdapter(ZhuJieMian adaptee) {
this.adaptee = adaptee;
}
public void windowClosing(WindowEvent e) {
adaptee.this_windowClosing(e);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -