?? dvdmanage.java~184~
字號:
package dvd;
import javax.swing.*;
import java.awt.*;
import com.borland.jbcl.layout.*;
import java.awt.event.*;
import java.sql.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class DVDManage extends JFrame {
private Connection connection;
private String url = "jdbc:odbc:sql";
XYLayout xYLayout1 = new XYLayout();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JTextField jtx1 = new JTextField();
JTextField jtx2 = new JTextField();
JTextField jtx3 = new JTextField();
JTextField jtx4 = new JTextField();
JTextField jtx5 = new JTextField();
JTextField jtx6 = new JTextField();
JTextField jtx7 = new JTextField();
JLabel jLabel9 = new JLabel();
JTextField jtx8 = new JTextField();
JLabel jLabel10 = new JLabel();
JTextField jtx9 = new JTextField();
JLabel jLabel11 = new JLabel();
JTextField jtx10 = new JTextField();
private String dvdid= jtx1.getText().trim();
private String directorid= jtx2.getText().trim();
private String level= jtx3.getText().trim();
private String mdate= jtx4.getText().trim();
private String DVDcn =jtx5.getText().trim();
private String DVDen = jtx6.getText().trim();
private String pprice= jtx7.getText().trim();
private String sprice= jtx8.getText().trim();
private String type= jtx9.getText().trim();
private String number= jtx10.getText().trim();
JLabel jLabel12 = new JLabel();
JLabel jLabel13 = new JLabel();
JLabel jLabel14 = new JLabel();
JLabel jLabel15 = new JLabel();
JLabel jLabel17 = new JLabel();
JLabel jLabel18 = new JLabel();
JLabel jLabel19 = new JLabel();
JPanel jPanel1 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JLabel jLabel16 = new JLabel();
JLabel jLabel20 = new JLabel();
JLabel jLabel21 = new JLabel();
JLabel jLabel22 = new JLabel();
JLabel jLabel23 = new JLabel();
JLabel jLabel24 = new JLabel();
JLabel jLabel25 = new JLabel();
public DVDManage() {
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();
}
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
jButton1.setFont(new java.awt.Font("Dialog", 0, 18));
jButton1.setForeground(Color.magenta);
jButton1.setText("增加新的DVD");
jButton1.addActionListener(new DVDManage_jButton1_actionAdapter(this));
this.getContentPane().setLayout(xYLayout1);
jLabel1.setFont(new java.awt.Font("Dialog", 0, 25));
jLabel1.setForeground(Color.magenta);
jLabel1.setText("DVD管理");
jButton2.setFont(new java.awt.Font("Dialog", 0, 18));
jButton2.setForeground(Color.magenta);
jButton2.setToolTipText("輸入影片ID號對于修改的屬性給于修改");
jButton2.setText("更新DVD信息");
jButton2.addActionListener(new DVDManage_jButton2_actionAdapter(this));
jButton3.setFont(new java.awt.Font("Dialog", 0, 18));
jButton3.setForeground(Color.magenta);
jButton3.setToolTipText("輸入影片ID號進行刪除");
jButton3.setSelected(false);
jButton3.setText("刪除DVD");
jButton3.addActionListener(new DVDManage_jButton3_actionAdapter(this));
jLabel2.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel2.setForeground(Color.blue);
jLabel2.setMaximumSize(new Dimension(34, 16));
jLabel2.setText("dvdID");
jLabel3.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel3.setForeground(Color.blue);
jLabel3.setText("導演ID");
jLabel4.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel4.setForeground(Color.blue);
jLabel4.setText("推薦等級");
jLabel5.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel5.setForeground(Color.blue);
jLabel5.setText("制作年份");
jLabel6.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel6.setForeground(Color.blue);
jLabel6.setText("影片中文名");
jLabel7.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel7.setForeground(Color.blue);
jLabel7.setToolTipText("");
jLabel7.setText("影片英文名");
jLabel8.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel8.setForeground(Color.blue);
jLabel8.setText("進價");
jtx2.setFont(new java.awt.Font("Dialog", 0, 15));
jtx2.setForeground(Color.orange);
jtx2.setToolTipText("");
jtx2.setText(" ");
jtx3.setFont(new java.awt.Font("Dialog", 0, 15));
jtx3.setForeground(Color.orange);
jtx3.setToolTipText("輸入的值應在1到5之間");
jtx3.setText(" ");
jtx4.setFont(new java.awt.Font("Dialog", 0, 15));
jtx4.setForeground(Color.orange);
jtx4.setText(" ");
jtx5.setFont(new java.awt.Font("Dialog", 0, 15));
jtx5.setForeground(Color.orange);
jtx5.setText(" ");
xYLayout1.setWidth(494);
xYLayout1.setHeight(478);
jtx6.setFont(new java.awt.Font("Dialog", 0, 15));
jtx6.setForeground(Color.orange);
jtx6.setText(" ");
jLabel9.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel9.setForeground(Color.blue);
jLabel9.setText("售價");
jLabel10.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel10.setForeground(Color.blue);
jLabel10.setText("影片類型");
jtx9.setFont(new java.awt.Font("Dialog", 0, 15));
jtx9.setForeground(Color.orange);
jtx9.setText(" ");
jLabel11.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel11.setForeground(Color.blue);
jLabel11.setText("存貨數量");
jtx10.setFont(new java.awt.Font("Dialog", 0, 15));
jtx10.setForeground(Color.orange);
jtx10.setText(" ");
jtx1.setFont(new java.awt.Font("Dialog", 0, 15));
jtx1.setForeground(Color.orange);
jtx1.setDisabledTextColor(Color.black);
jtx1.setText("");
jtx1.addActionListener(new DVDManage_jtx1_actionAdapter(this));
jtx7.setFont(new java.awt.Font("Dialog", 0, 15));
jtx7.setForeground(Color.orange);
jtx7.setToolTipText("進價應低于售價");
jtx7.setText("");
jtx8.setFont(new java.awt.Font("Dialog", 0, 15));
jtx8.setForeground(Color.orange);
jtx8.setToolTipText("售價應高于進價");
jtx8.setText("");
jLabel12.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel12.setForeground(Color.red);
jLabel12.setText("*");
jLabel13.setText("*");
jLabel13.setForeground(Color.red);
jLabel13.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel14.setText("*");
jLabel14.setForeground(Color.red);
jLabel14.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel15.setText("*");
jLabel15.setForeground(Color.red);
jLabel15.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel17.setText("*");
jLabel17.setForeground(Color.red);
jLabel17.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel18.setText("*");
jLabel18.setForeground(Color.red);
jLabel18.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel19.setText("*");
jLabel19.setForeground(Color.red);
jLabel19.setFont(new java.awt.Font("Dialog", 0, 20));
jLabel16.setForeground(Color.blue);
jPanel1.setLayout(xYLayout2);
jPanel1.setBackground(Color.white);
jLabel16.setFont(new java.awt.Font("Dialog", 0, 16));
jLabel16.setForeground(SystemColor.desktop);
jLabel16.setText("操作說明:");
jLabel20.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel20.setForeground(SystemColor.desktop);
jLabel20.setText("1.增加新的DVD時,*為必添項。");
jLabel21.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel21.setForeground(SystemColor.desktop);
jLabel21.setText("2.更新DVD信息時,dvdId為必錄入 ");
jLabel22.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel22.setForeground(SystemColor.desktop);
jLabel22.setText("信息,可同時修改多項信息。");
jLabel23.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel23.setForeground(SystemColor.desktop);
jLabel23.setText("3.刪除DVD時,為防止dvdID輸入錯 ");
jLabel24.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel24.setForeground(SystemColor.desktop);
jLabel24.setText("誤,導致信息錯誤的刪除,請同時 ");
jLabel25.setFont(new java.awt.Font("Dialog", 0, 15));
jLabel25.setForeground(SystemColor.desktop);
jLabel25.setText("輸入dvdID和影片 中文名。");
this.getContentPane().setBackground(Color.lightGray);
this.getContentPane().add(jButton1, new XYConstraints(23, 80, 144, 38));
this.getContentPane().add(jButton3, new XYConstraints(22, 182, 145, 36));
this.getContentPane().add(jButton2, new XYConstraints(23, 131, 144, 36));
this.getContentPane().add(jLabel3, new XYConstraints(249, 103, 67, 24));
this.getContentPane().add(jLabel4, new XYConstraints(249, 143, 61, 23));
this.getContentPane().add(jLabel5, new XYConstraints(249, 183, 64, 24));
this.getContentPane().add(jLabel6, new XYConstraints(249, 223, 77, 25));
this.getContentPane().add(jLabel7, new XYConstraints(249, 263, 78, 23));
this.getContentPane().add(jLabel8, new XYConstraints(249, 303, 44, 24));
this.getContentPane().add(jLabel9, new XYConstraints(249, 343, 49, 27));
this.getContentPane().add(jLabel10, new XYConstraints(249, 383, 73, 24));
this.getContentPane().add(jtx2, new XYConstraints(324, 103, 126, 29));
this.getContentPane().add(jtx3, new XYConstraints(324, 143, 126, 29));
this.getContentPane().add(jtx5, new XYConstraints(324, 223, 126, 29));
this.getContentPane().add(jtx10, new XYConstraints(324, 423, 126, 29));
this.getContentPane().add(jtx4, new XYConstraints(324, 183, 126, 29));
this.getContentPane().add(jtx8, new XYConstraints(324, 343, 126, 29));
this.getContentPane().add(jtx9, new XYConstraints(324, 383, 126, 29));
this.getContentPane().add(jLabel11, new XYConstraints(249, 424, 68, 21));
this.getContentPane().add(jtx1, new XYConstraints(324, 63, 126, 29));
this.getContentPane().add(jtx7, new XYConstraints(324, 299, 126, 29));
this.getContentPane().add(jLabel2, new XYConstraints(249, 63, 47, 25));
this.getContentPane().add(jtx6, new XYConstraints(324, 263, 126, 29));
this.getContentPane().add(jLabel12, new XYConstraints(453, 63, 29, -1));
this.getContentPane().add(jLabel13, new XYConstraints(453, 343, 29, -1));
this.getContentPane().add(jLabel14, new XYConstraints(453, 143, 29, -1));
this.getContentPane().add(jLabel15, new XYConstraints(453, 223, 29, -1));
this.getContentPane().add(jLabel17, new XYConstraints(453, 383, 29, -1));
this.getContentPane().add(jLabel18, new XYConstraints(453, 303, 29, -1));
this.getContentPane().add(jLabel19, new XYConstraints(453, 424, 29, -1));
this.getContentPane().add(jPanel1, new XYConstraints(3, 264, 238, 186));
jPanel1.add(jLabel16, new XYConstraints(5, 1, 78, 29));
jPanel1.add(jLabel20, new XYConstraints(5, 27, 219, 31));
jPanel1.add(jLabel21, new XYConstraints(5, 57, 236, 29));
jPanel1.add(jLabel22, new XYConstraints(5, 77, 215, 29));
jPanel1.add(jLabel24, new XYConstraints(5, 127, 239, 39));
jPanel1.add(jLabel23, new XYConstraints(5, 107, 240, 36));
jPanel1.add(jLabel25, new XYConstraints(5, 147, 234, 34));
this.getContentPane().add(jLabel1, new XYConstraints(174, 15, 108, 43));
}
void jtx1_actionPerformed(ActionEvent e) {
}
void jButton1_actionPerformed(ActionEvent e) {
try {
Statement statement = connection.createStatement();
String dvdid= jtx1.getText().trim();
String directorid= jtx2.getText().trim();
String level= jtx3.getText().trim();
String mdate= jtx4.getText().trim();
String DVDcn =jtx5.getText().trim();
String DVDen = jtx6.getText().trim();
String pprice= jtx7.getText().trim();
String sprice= jtx8.getText().trim();
String type= jtx9.getText().trim();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -