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

📄 entry.java~171~

📁 管理dvd碟片的软件
💻 JAVA~171~
字号:
package dvd;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dbswing.*;
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 Entry extends JFrame {
  JPanel contentPane;
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JLabel jLabel2 = new JLabel();
  JTextField username = new JTextField();
  JLabel jLabel3 = new JLabel();
  JButton jButton1 = new JButton();
  JPasswordField password = new JPasswordField();

  private Connection connection;
  private   String url = "jdbc:odbc:sql";

  private Icon icons=new ImageIcon("000.jpg");


  CustomerView customer= new CustomerView();
  WaiterFrame waiter= new WaiterFrame();
  DVDManage dvdmanage= new DVDManage();
  ManagerView managerView=new ManagerView();


  Database database1 = new Database();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  JRadioButton jrb1 = new JRadioButton();
  JRadioButton jrb2 = new JRadioButton();
  ButtonGroup buttonGroup1 = new ButtonGroup();
  ButtonGroup buttonGroup2 = new ButtonGroup();
  JButton jb4 = new JButton();
  JPanel jPanel2 = new JPanel();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel4 = new JLabel();
  GridBagLayout gridBagLayout1 = new GridBagLayout();
  JLabel jLabel5 = new JLabel(icons);
  XYLayout xYLayout1 = new XYLayout();

  //Construct the frame
  public Entry() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }

  }
  //Component initialization
  private void jbInit() throws Exception  {
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    this.setLocale(java.util.Locale.getDefault());
    this.setSize(new Dimension(662,500));
    this.setTitle("Welcome to HIT DVD shop");
    jPanel1.setLayout(xYLayout1);
    jLabel2.setFont(new java.awt.Font("Dialog", 1, 18));
    jLabel2.setForeground(SystemColor.activeCaption);
    jLabel2.setText("用户名");
    username.setFont(new java.awt.Font("Dialog", 0, 14));
    username.setForeground(new Color(0, 125, 0));
    username.setText("");
    jLabel3.setFont(new java.awt.Font("Dialog", 1, 18));
    jLabel3.setForeground(SystemColor.activeCaption);
    jLabel3.setText("  密码");
    jButton1.setBackground(SystemColor.inactiveCaption);
    jButton1.setFont(new java.awt.Font("Dialog", 2, 18));
    jButton1.setForeground(SystemColor.activeCaption);
    jButton1.setText("顾客登录方式 ");
    jButton1.addActionListener(new Entry_jButton1_actionAdapter(this));
    password.setForeground(new Color(0, 125, 0));
    password.setText("");
    password.addActionListener(new Entry_password_actionAdapter(this));
    database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:sql;databasename=DVD", "jacky_didi", "19831208ccdi", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
    queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select * from DVD", null, true, Load.ALL));
    jrb1.setBackground(SystemColor.activeCaptionText);
    jrb1.setFont(new java.awt.Font("Dialog", 0, 14));
    jrb1.setForeground(SystemColor.activeCaption);
    jrb1.setSelected(true);
    jrb1.setText("经理登陆");
    jrb1.addActionListener(new Entry_jrb1_actionAdapter(this));
    jrb2.setBackground(SystemColor.activeCaptionText);
    jrb2.setFont(new java.awt.Font("Dialog", 0, 14));
    jrb2.setForeground(SystemColor.activeCaption);
    jrb2.setAlignmentY((float) 0.5);
    jrb2.setSelected(false);
    jrb2.setText("服务人员登陆");
    jrb2.addActionListener(new Entry_jrb2_actionAdapter(this));
    jPanel1.setBackground(SystemColor.text);
    jPanel1.setFont(new java.awt.Font("Dialog", 0, 14));
    jPanel1.setDebugGraphicsOptions(0);
    jPanel1.setMinimumSize(new Dimension(450, 420));
    jb4.setBackground(SystemColor.inactiveCaption);
    jb4.setFont(new java.awt.Font("Dialog", 0, 18));
    jb4.setForeground(SystemColor.activeCaption);
    jb4.setText("登陆");
    jb4.addActionListener(new Entry_jb4_actionAdapter(this));
    jPanel2.setBackground(Color.orange);
    jPanel2.setAlignmentY((float) 0.5);
    jPanel2.setLayout(gridBagLayout1);
    jLabel1.setFont(new java.awt.Font("SansSerif", 0, 40));
    jLabel1.setForeground(Color.blue);
    jLabel1.setText("Welcome to");
    jLabel4.setFont(new java.awt.Font("SansSerif", 0, 40));
    jLabel4.setForeground(Color.blue);
    jLabel4.setText("HIT DVD shop!");
    jPanel2.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
            ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(8, 9, 0, 270), 0, 0));
    jPanel2.add(jLabel4, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(1, 214, 4, 18), 3, -7));
    jPanel1.add(jb4,  new XYConstraints(424, 201, 83, 30));
    jPanel1.add(jButton1,  new XYConstraints(399, 300, -1, -1));
    jPanel1.add(jLabel5,  new XYConstraints(0, 372, 659, 97));
    jPanel1.add(username,  new XYConstraints(165, 170, 144, 37));
    jPanel1.add(jLabel2,  new XYConstraints(54, 172, 66, 31));
    jPanel1.add(password,  new XYConstraints(166, 231, 143, 37));
    jPanel1.add(jrb1,  new XYConstraints(47, 303, 111, 24));
    jPanel1.add(jrb2,  new XYConstraints(182, 303, 117, 24));
    jPanel1.add(jLabel3,  new XYConstraints(49, 231, 59, 29));
    jPanel1.add(jPanel2,  new XYConstraints(0, 0, 661, 111));
    buttonGroup2.add(jrb1);
    buttonGroup2.add(jrb2);
    contentPane.add(jPanel1, BorderLayout.CENTER);
  }
  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      // System.exit(0);
    }
  }

  void jButton1_actionPerformed(ActionEvent e) {
    customer.setSize(515,500);
    customer.show();
  }

  void password_actionPerformed(ActionEvent e) {

  }



  void jrb1_actionPerformed(ActionEvent e) {

  }

  void jrb2_actionPerformed(ActionEvent e) {

  }

  void jb4_actionPerformed(ActionEvent e) {

    String loginName = username.getText().trim();
    char[]   loginPass1= password.getPassword();
    String loginPass=new String(loginPass1);

    if(!(loginName.equals("")||loginPass.equals("")))
    {
      String quire2="select * from waiter where waiterName='"+loginName + "'and passWord='"+loginPass+"'";
      String quire1="select * from manager where managerName='"+loginName + "'and passWord='"+loginPass+"'";


      if(jrb1.isSelected()){
        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,quire1);

        movieFrame.setSize(500,500);
        if(movieFrame.haverecords) {
          managerView.setSize(700,600);
          managerView.show();
          movieFrame.dispose();
          this.dispose();
        }
        else {
          movieFrame.dispose();
          username.setText("");
          password.setText("");
        }
      }
      else  {
        if(jrb2.isSelected()){
          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,quire2);

          movieFrame.setSize(500,500);
          if(movieFrame.haverecords) {
            waiter.setSize(550,500);
            waiter.show();
            movieFrame.dispose();
            this.dispose();
          }
          else {
            movieFrame.dispose();
            username.setText("");
            password.setText("");
          }
        }
      }
    }
    else JOptionPane.showMessageDialog(null,"如果想通过经理或服务人员的身份进入请输入用户名和密码并选择身份!","attention please!",JOptionPane.INFORMATION_MESSAGE);

  }

}
class Entry_jButton1_actionAdapter implements java.awt.event.ActionListener {
  Entry adaptee;

  Entry_jButton1_actionAdapter(Entry adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class Entry_password_actionAdapter implements java.awt.event.ActionListener {
  Entry adaptee;

  Entry_password_actionAdapter(Entry adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.password_actionPerformed(e);
  }
}

class Entry_jrb1_actionAdapter implements java.awt.event.ActionListener {
  Entry adaptee;

  Entry_jrb1_actionAdapter(Entry adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jrb1_actionPerformed(e);
  }
}

class Entry_jrb2_actionAdapter implements java.awt.event.ActionListener {
  Entry adaptee;

  Entry_jrb2_actionAdapter(Entry adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jrb2_actionPerformed(e);
  }
}

class Entry_jb4_actionAdapter implements java.awt.event.ActionListener {
  Entry adaptee;

  Entry_jb4_actionAdapter(Entry adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jb4_actionPerformed(e);
  }
}

⌨️ 快捷键说明

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