?? customerview.java
字號(hào):
package dvd;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.*;
import java.awt.event.*;
import com.borland.dbswing.*;
import java.sql.*;
import javax.swing.Timer;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class CustomerView extends JFrame {
private String names[]={"USA","HK","China","FR","TW"};
private Connection connection;
private String url = "jdbc:odbc:sql";
java.util.Date date=new java.util.Date();
String Time=date.toString();
Timer timer;
JPanel jPanel1 = new JPanel();
JLabel jLabel1 = new JLabel();
JPanel jPanel2 = new JPanel();
JButton jButton1 = new JButton();
JPanel jPanel3 = new JPanel();
JLabel jLabel2 = new JLabel();
ButtonGroup buttonGroup1 = new ButtonGroup();
ButtonGroup buttonGroup2 = new ButtonGroup();
XYLayout xYLayout2 = new XYLayout();
ButtonGroup buttonGroup3 = new ButtonGroup();
JList jList1 = new JList();
JTextField jtx1 = new JTextField();
JPanel jPanel4 = new JPanel();
XYLayout xYLayout4 = new XYLayout();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JTextField jtx2 = new JTextField();
JLabel jLabel5 = new JLabel();
JButton jButton2 = new JButton();
JPanel jPanel6 = new JPanel();
JLabel jLabel6 = new JLabel();
XYLayout xYLayout5 = new XYLayout();
JComboBox jcb2 = new JComboBox(names);
JLabel jLabel7 = new JLabel();
JTextField jtx3 = new JTextField();
JLabel jLabel8 = new JLabel();
JButton jButton3 = new JButton();
JPanel jPanel7 = new JPanel();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
JLabel jLabel11 = new JLabel();
GridBagLayout gridBagLayout2 = new GridBagLayout();
XYLayout xYLayout1 = new XYLayout();
JComboBox jcb1 = new JComboBox(names);
JButton jButton4 = new JButton();
ButtonGroup buttonGroup4 = new ButtonGroup();
JRadioButton jrb1 = new JRadioButton();
JRadioButton jrb2 = new JRadioButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JLabel jl2 = new JLabel();
XYLayout xYLayout3 = new XYLayout();
// Entry a=new Entry();
public CustomerView() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(gridBagLayout2);
jPanel1.setBackground(Color.lightGray);
jLabel1.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel1.setForeground(Color.yellow);
jLabel1.setText("Welcome to HIT DVD shop");
jLabel2.setIconTextGap(4);
jButton1.setBackground(Color.orange);
jButton1.setFont(new java.awt.Font("DialogInput", 2, 15));
jButton1.setForeground(Color.blue);
jButton1.setToolTipText("查詢本店所有供應(yīng)影片及影片相關(guān)信息");
jButton1.setActionCommand("影片總覽");
jButton1.setBorderPainted(true);
jButton1.setHorizontalAlignment(SwingConstants.CENTER);
jButton1.setText("影片總覽");
jButton1.addActionListener(new CustomerView_jButton1_actionAdapter(this));
jPanel2.setBackground(Color.lightGray);
jPanel2.setPreferredSize(new Dimension(285, 38));
jPanel2.setLayout(xYLayout3);
jPanel3.setBackground(Color.lightGray);
jPanel3.setLayout(xYLayout2);
jLabel2.setFont(new java.awt.Font("Dialog", 0, 18));
jLabel2.setForeground(SystemColor.activeCaption);
jLabel2.setText("影片搜索");
jtx1.setFont(new java.awt.Font("Dialog", 0, 14));
jtx1.setForeground(Color.magenta);
jtx1.setText("");
jtx1.addActionListener(new CustomerView_jtx1_actionAdapter(this));
jPanel4.setLayout(xYLayout4);
jPanel4.setBackground(Color.lightGray);
jLabel3.setFont(new java.awt.Font("Dialog", 0, 18));
jLabel3.setForeground(SystemColor.activeCaption);
jLabel3.setText("演員搜索");
this.getContentPane().setBackground(Color.lightGray);
this.setTitle("");
jLabel4.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel4.setForeground(SystemColor.desktop);
jLabel4.setText("按演員國(guó)籍");
jtx2.setForeground(Color.magenta);
jtx2.setToolTipText("輸入想要查詢的演員名");
jtx2.setText("");
jtx2.addActionListener(new CustomerView_jtx2_actionAdapter(this));
jLabel5.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel5.setForeground(SystemColor.desktop);
jLabel5.setText("按演員姓名");
jButton2.setFont(new java.awt.Font("Dialog", 0, 18));
jButton2.setForeground(Color.blue);
jButton2.setActionCommand("搜索");
jButton2.setText("搜索");
jButton2.addActionListener(new CustomerView_jButton2_actionAdapter(this));
jLabel6.setFont(new java.awt.Font("Dialog", 0, 18));
jLabel6.setForeground(SystemColor.activeCaption);
jLabel6.setText("導(dǎo)演搜索");
jPanel6.setLayout(xYLayout5);
jLabel7.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel7.setForeground(SystemColor.activeCaption);
jLabel7.setMinimumSize(new Dimension(70, 20));
jLabel7.setText("按導(dǎo)演國(guó)籍");
jtx3.setFont(new java.awt.Font("MS Sans Serif", 0, 11));
jtx3.setForeground(Color.magenta);
jtx3.setToolTipText("輸入想要查詢的導(dǎo)演名");
jtx3.setText("");
jtx3.addActionListener(new CustomerView_jtx3_actionAdapter(this));
jLabel8.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel8.setForeground(SystemColor.activeCaption);
jLabel8.setText("按導(dǎo)演姓名");
jButton3.setFont(new java.awt.Font("Dialog", 0, 18));
jButton3.setForeground(Color.blue);
jButton3.setText("搜索");
jButton3.addActionListener(new CustomerView_jButton3_actionAdapter(this));
jPanel6.setBackground(Color.lightGray);
jPanel7.setBackground(Color.orange);
jPanel7.setLayout(xYLayout1);
jLabel9.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel9.setForeground(Color.red);
jLabel9.setText("總店地址:哈工大二區(qū)五公寓一樓");
jLabel10.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel10.setForeground(Color.red);
jLabel10.setText("碟片咨詢電話:82339727");
jLabel11.setFont(new java.awt.Font("Dialog", 0, 14));
jLabel11.setForeground(Color.red);
jLabel11.setText("碟片咨詢E-mail:jacky_didi@hit.edu.cn");
jcb2.addActionListener(new CustomerView_jcb2_actionAdapter(this));
jcb1.addActionListener(new CustomerView_jcb1_actionAdapter(this));
jButton4.setFont(new java.awt.Font("Dialog", 0, 18));
jButton4.setForeground(Color.blue);
jButton4.setText("搜索");
jButton4.addActionListener(new CustomerView_jButton4_actionAdapter(this));
jrb1.setBackground(Color.lightGray);
jrb1.setFont(new java.awt.Font("Dialog", 0, 14));
jrb1.setText("模糊");
jrb2.setBackground(Color.lightGray);
jrb2.setFont(new java.awt.Font("Dialog", 0, 15));
jrb2.setToolTipText("");
jrb2.setSelected(true);
jrb2.setText("精確");
jButton5.setFont(new java.awt.Font("Dialog", 0, 18));
jButton5.setForeground(Color.blue);
jButton5.setText("搜索");
jButton5.addActionListener(new CustomerView_jButton5_actionAdapter(this));
jButton6.setFont(new java.awt.Font("Dialog", 0, 18));
jButton6.setForeground(Color.blue);
jButton6.setText("搜索");
jButton6.addActionListener(new CustomerView_jButton6_actionAdapter(this));
jcb1.addActionListener(new CustomerView_jcb1_actionAdapter(this));
jcb1.setForeground(Color.magenta);
jcb2.setForeground(Color.magenta);
jl2.setForeground(new Color(0, 125, 0));
jl2.setText("");
jPanel3.add(jLabel2, new XYConstraints(54, 8, 74, 29));
jPanel3.add(jList1, new XYConstraints(160, 11, -1, -1));
jPanel3.add(jButton4, new XYConstraints(338, 8, 79, 30));
jPanel3.add(jtx1, new XYConstraints(132, 8, 142, 29));
jPanel3.add(jrb1, new XYConstraints(138, 41, 60, 19));
jPanel3.add(jrb2, new XYConstraints(204, 41, 66, 19));
this.getContentPane().add(jPanel2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, -2, 0, 0), 164, 96));
jPanel2.add(jl2, new XYConstraints(299, 12, 230, 22));
jPanel2.add(jButton1, new XYConstraints(50, 2, 225, 36));
this.getContentPane().add(jPanel4, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 1), 74, 100));
jPanel7.add(jLabel11, new XYConstraints(146, 52, 240, 23));
jPanel7.add(jLabel10, new XYConstraints(101, 33, 162, 19));
jPanel7.add(jLabel9, new XYConstraints(30, 8, -1, 18));
this.getContentPane().add(jPanel6, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0
,GridBagConstraints.SOUTHEAST, GridBagConstraints.HORIZONTAL, new Insets(6, 0, 0, 0), 17, 95));
this.getContentPane().add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(3, 0, 5, 0), 192, 87));
jPanel1.add(jLabel1, null);
jPanel6.add(jcb2, new XYConstraints(140, 20, 96, 31));
jPanel6.add(jLabel7,new XYConstraints(141, 0, 94, 25));
jPanel6.add(jLabel8, new XYConstraints(141, 49, 82, 24));
jPanel6.add(jLabel6, new XYConstraints(54, 32, 84, 25));
jPanel6.add(jButton3, new XYConstraints(338, 20, 79, 30));
jPanel6.add(jtx3, new XYConstraints(140, 68, 96, 31));
jPanel6.add(jButton6, new XYConstraints(338, 68, 79, 30));
this.getContentPane().add(jPanel7, new GridBagConstraints(0, 5, 1, 4, 1.0, 1.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(1, 0, 3, 0), 0, 91));
jPanel4.add(jcb1, new XYConstraints(141, 20, 96, 31));
jPanel4.add(jtx2, new XYConstraints(140, 69, 96, 31));
jPanel4.add(jLabel5, new XYConstraints(141, 48, 96, -1));
jPanel4.add(jLabel4, new XYConstraints(141, 4, 91, 19));
jPanel4.add(jButton2, new XYConstraints(338, 20, 79, 30));
jPanel4.add(jButton5, new XYConstraints(338, 69, 79, 30));
jPanel4.add(jLabel3, new XYConstraints(54, 42, -1, 28));
this.getContentPane().add(jPanel3, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, -2, 2, 0), 166, 101));
buttonGroup1.add(jrb1);
buttonGroup1.add(jrb2);
int delay = 1;//milliseconds
ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jl2.setText("當(dāng)前日期:"+new java.util.Date().toString());
}
};
timer=new Timer(delay, taskPerformer);
timer.start();
}
void jButton1_actionPerformed(ActionEvent e) {
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connection = DriverManager.getConnection(
url );
}
catch ( ClassNotFoundException cnfex ) {
System.err.println(
"Failed to load JDBC/ODBC driver." );
cnfex.printStackTrace();
System.exit( 1 ); // terminate program
}
catch ( SQLException sqlex ) {
System.err.println( "Unable to connect" );
sqlex.printStackTrace();
}
DVDFrame movieFrame=new DVDFrame(connection);
movieFrame.setSize(450,450);
movieFrame.show();
}
void jcb2_actionPerformed(ActionEvent e) {
}
void jcb1_actionPerformed(ActionEvent e) {
}
void jtx3_actionPerformed(ActionEvent e) {
}
void jButton2_actionPerformed(ActionEvent e) {
String roleNation= jcb1.getSelectedItem().toString();
String quire3="SELECT * FROM role where r_nation like '%"+roleNation+"%'";
try {//3
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connection = DriverManager.getConnection( url );
}//3
catch ( ClassNotFoundException cnfex ) {//4
System.err.println(
"Failed to load JDBC/ODBC driver." );
cnfex.printStackTrace();
System.exit( 1 ); // terminate program
}//4
catch ( SQLException sqlex ) {//5
System.err.println( "Unable to connect" );
sqlex.printStackTrace();
}//5
DVDFrame movieFrame=new DVDFrame(connection,quire3);
movieFrame.setSize(450,450);
}
void jtx1_actionPerformed(ActionEvent e) {
}
void jButton4_actionPerformed(ActionEvent e) {//0
String movieName= jtx1.getText().trim();
if (!movieName.equals(""))
{//1
String quire1="SELECT * FROM movie_inf where 中文名 like '%"+movieName+"%'";
String quire2="select * from movie_inf where 中文名='"+movieName+"'";
if(jrb1.isSelected()){//2
try {//3
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connection = DriverManager.getConnection( url );
}//3
catch ( ClassNotFoundException cnfex ) {//4
System.err.println(
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -