📄 yuechaxun.java~67~
字号:
package mysystem;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import mysystem.Face;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import mysystem.Shangjiface;
import javax.swing.JFrame;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Color;
import java.awt.Font;
import javax.swing.ImageIcon;
import mysystem.Lianjie;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import javax.swing.JOptionPane;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class yuechaxun extends JPanel {
Face main;
Lianjie co=new Lianjie();
Statement s;
ResultSet rs;
Connection c;
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JOptionPane jOptionPane1 = new JOptionPane();
public yuechaxun(Face h) {
try {
main=h;
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
jLabel1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 15));
jLabel1.setForeground(Color.red);
jLabel1.setText("卡号");
jLabel1.setBounds(new Rectangle(30, 150, 80, 20));
jTextField1.setForeground(Color.magenta);
jTextField1.setText("");
jTextField1.setBounds(new Rectangle(80, 150, 80, 20));
jLabel2.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 15));
jLabel2.setForeground(Color.red);
jLabel2.setText("余额 :");
jLabel2.setBounds(new Rectangle(30, 200, 80, 30));
jButton1.setBounds(new Rectangle(124, 344, 57, 20));
jButton1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 12));
jButton1.setForeground(Color.magenta);
jButton1.setText("上机");
jButton1.addActionListener(new yuechaxun_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(228, 345, 57, 20));
jButton2.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 12));
jButton2.setForeground(Color.magenta);
jButton2.setText("下机");
jButton2.addActionListener(new yuechaxun_jButton2_actionAdapter(this));
jButton3.setBounds(new Rectangle(14, 344, 65, 20));
jButton3.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 15));
jButton3.setForeground(Color.magenta);
jButton3.setText("查询");
jButton3.addActionListener(new yuechaxun_jButton3_actionAdapter(this));
jLabel3.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 25));
jLabel3.setForeground(Color.red);
jLabel3.setText("");
jLabel3.setBounds(new Rectangle(80, 200, 80, 30));
jLabel4.setText("");
jLabel4.setBounds(new Rectangle(0, 0, 650, 488));
jLabel5.setFont(new java.awt.Font("黑体", Font.PLAIN, 25));
jLabel5.setForeground(Color.magenta);
jLabel5.setText("");
jLabel5.setBounds(new Rectangle(80, 200, 80, 30));
this.add(jLabel1);
this.add(jTextField1);
this.add(jLabel2);
this.add(jLabel3);
this.add(jButton2);
this.add(jLabel5);
this.add(jButton3);
this.add(jButton1);
this.add(jLabel4);
jLabel4 .setIcon(new ImageIcon("11.jpg"));
}
public void jButton1_actionPerformed(ActionEvent e) {
Shangjiface jiemian=new Shangjiface(main) ;
main.setContentPane(jiemian);
main.show();
}
public void jButton2_actionPerformed(ActionEvent e) {
xiajiface xia=new xiajiface(main);
xia.setSize(483,344);
Dimension dsize=xia.getPreferredSize();
Dimension fsize=xia.getSize();
Point loc=getLocation();
xia.setLocation(2*(fsize.width-dsize.width)/3+loc.x,4*(fsize.height-dsize.height)/5+loc.y );
xia.show();
}
public void jButton3_actionPerformed(ActionEvent e) {
c=co.con(); String u=jTextField1.getText().toString();
try{
s=c.createStatement();
rs=s.executeQuery("select fee from card where kahao='"+u+"'and name <>'null'");
if(rs.next())
{
jLabel3.setText( rs.getString(1));
}
else {
jOptionPane1.showMessageDialog(this,"查询失败!无此卡号或该卡号尚未激活!");
jLabel3.setText("");
}
} catch(SQLException N)
{System.out .println(N);
}
}
}
class yuechaxun_jButton3_actionAdapter implements ActionListener {
private yuechaxun adaptee;
yuechaxun_jButton3_actionAdapter(yuechaxun adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class yuechaxun_jButton1_actionAdapter implements ActionListener {
private yuechaxun adaptee;
yuechaxun_jButton1_actionAdapter(yuechaxun adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class yuechaxun_jButton2_actionAdapter implements ActionListener {
private yuechaxun adaptee;
yuechaxun_jButton2_actionAdapter(yuechaxun adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -