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

📄 customerframe.java

📁 java在线商店的源代码。编写十分规范的哦
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/**
 * Copyright (c) 1996-2004 Borland Software Corporation.  All Rights Reserved.
 * 
 * This SOURCE CODE FILE, which has been provided by Borland Software as part
 * of a Borland Software product for use ONLY by licensed users of the product,
 * includes CONFIDENTIAL and PROPRIETARY information of Borland Software.  
 *
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
 * THE PRODUCT.
 *
 * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND SOFTWARE, ITS
 * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
 * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
 * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
 * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
 * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
 * DERIVED FROM THIS SOURCE CODE FILE.
 */
//------------------------------------------------------------------------------
// Copyright (c) 1996-2004 Borland Software Corporation.  All Rights Reserved.
//------------------------------------------------------------------------------

package com.borland.samples.orderentry;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

import com.borland.dbswing.*;
import com.borland.dx.dataset.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dx.text.Alignment;

/**
 * CustomerFrame implements the Customer Form that is used to maintain
 * Customer records. This form allows users to view or update
 * existing customers, or enter new customers. A standard navigation control
 * is used to allow for record browsing. A master-detail relationship between
 * customers and orders is used to display a list of orders placed by each
 * customer.
 *
 * <P>
 * This class employs the Singleton pattern to ensure that the class has only
 * one instance. You can access the singleton instance by calling the
 * getCustomerFrame method.
 */
public class CustomerFrame extends JFrame {
  private static DataModule1 dm = DataModule1.getDataModule();

  private static CustomerFrame myCustomerFrame;
  private QueryDataSet qdsCustomer;
  private QueryDataSet qdsCustOrder;
  JPanel contentPane;
  JPanel pnlCustomerInfo = new JPanel();
  JPanel pnlOrders = new JPanel();
  JPanel pnlToolBar = new JPanel();
  JPanel pnlMain = new JPanel();
  BorderLayout borderLayout1 = new BorderLayout();
  BorderLayout borderLayout2 = new BorderLayout();
  GridBagLayout gridBagLayout1 = new GridBagLayout();
  GridBagLayout gridBagLayout2 = new GridBagLayout();
  JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();
  JdbTable jdbTable1 = new JdbTable();
  JdbTextField txtFirstName = new JdbTextField();
  JdbTextField txtMI = new JdbTextField();
  JdbTextField txtLastName = new JdbTextField();
  JdbTextField txtAddr1 = new JdbTextField();
  JdbTextField txtAddr2 = new JdbTextField();
  JdbTextField txtCity = new JdbTextField();
  JdbTextField txtState = new JdbTextField();
  JdbTextField txtPostalCode = new JdbTextField();
  JdbTextField txtCountry = new JdbTextField();
  JdbTextField txtPhone = new JdbTextField();
  JdbTextField txtFax = new JdbTextField();
  JdbTextField txtEmail = new JdbTextField();
  JdbLabel lblCustomerID = new JdbLabel();
  JLabel jLabel1 = new JLabel();
  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();
  JLabel jLabel9 = new JLabel();
  JLabel jLabel10 = new JLabel();
  JLabel jLabel11 = new JLabel();
  JLabel jLabel12 = new JLabel();
  JLabel lblOrders = new JLabel();
  JdbStatusLabel jdbStatusLabel1 = new JdbStatusLabel();
  JButton btnViewOrder = new JButton();
  JButton btnClose = new JButton();
  JButton btnNewOrder = new JButton();
  JPanel pnlOrderButtons = new JPanel();
  JdbLabel imageLabel1 = new JdbLabel();
  GridBagLayout gridBagLayout3 = new GridBagLayout();
  JScrollPane jScrollPane1 = new JScrollPane();
  ResourceBundle res = java.util.ResourceBundle.getBundle("com.borland.samples.orderentry.Res");
  JPanel jPanel1 = new JPanel();
  GridLayout gridLayout1 = new GridLayout();
  JPanel jPanel2 = new JPanel();
  BorderLayout borderLayout3 = new BorderLayout();

  /**
   * The constructor is public, but you should use the getCustomerFrame
   * method to get an instance of this class.
   */
  public CustomerFrame() {
    try {
      jbInit();   // initialize frame's controls (JBuilder designer)
      initData(); // initialize dataset and data-aware components.
    }
    catch (Exception e) {
      e.printStackTrace();
    };
  }


  /**
   * Method generated and maintained by JBuilder designer to initialize
   * control properties.
   * @throws Exception exception
   */
  private void jbInit() throws Exception{
    contentPane = (JPanel) this.getContentPane();
    this.setSize(new Dimension(420, 520));
    this.setTitle(res.getString("CF_Customers"));
    this.addWindowListener(new java.awt.event.WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        this_windowClosing(e);
      }
    });
    contentPane.setLayout(borderLayout2);
    jdbNavToolBar1.setDataSet(dm.getCustomerDataSet());
    jdbNavToolBar1.setButtonStateDitto(JdbNavToolBar.HIDDEN);
    jdbNavToolBar1.setButtonStateSave(JdbNavToolBar.HIDDEN);
    jdbNavToolBar1.setButtonStateRefresh(JdbNavToolBar.HIDDEN);
    jdbNavToolBar1.setFloatable(false);
    jdbTable1.setDataSet(dm.getCustOrderDataSet());
    jdbTable1.setRowSelectionAllowed(true);
    jdbTable1.setCellSelectionEnabled(false);
    txtFirstName.setColumnName("FIRSTNAME");
    txtFirstName.setDataSet(dm.getCustomerDataSet());
    txtMI.setColumnName("MI");
    txtMI.setDataSet(dm.getCustomerDataSet());
    txtLastName.setColumnName("LASTNAME");
    txtLastName.setDataSet(dm.getCustomerDataSet());
    txtAddr1.setColumnName("ADDR1");
    txtAddr1.setDataSet(dm.getCustomerDataSet());
    txtAddr2.setColumnName("ADDR2");
    txtAddr2.setDataSet(dm.getCustomerDataSet());
    txtCity.setColumnName("CITY");
    txtCity.setDataSet(dm.getCustomerDataSet());
    txtState.setColumnName("STATE");
    txtState.setDataSet(dm.getCustomerDataSet());
    txtPostalCode.setColumnName("POSTALCODE");
    txtPostalCode.setDataSet(dm.getCustomerDataSet());
    txtCountry.setColumnName("COUNTRY");
    txtCountry.setDataSet(dm.getCustomerDataSet());
    txtPhone.setColumnName("PHONE");
    txtPhone.setDataSet(dm.getCustomerDataSet());
    txtFax.setColumnName("FAX");
    txtFax.setDataSet(dm.getCustomerDataSet());
    txtEmail.setColumnName("EMAIL");
    txtEmail.setDataSet(dm.getCustomerDataSet());
    pnlCustomerInfo.setLayout(gridBagLayout1);
    pnlOrders.setLayout(borderLayout1);
    pnlToolBar.setLayout(gridBagLayout3);
    pnlMain.setLayout(gridBagLayout2);
    lblCustomerID.setColumnName("ID");
    lblCustomerID.setDataSet(dm.getCustomerDataSet());
    lblCustomerID.setFont(new Font("Dialog", 1, 12));
    lblCustomerID.setForeground(Color.red);
    jLabel1.setText(res.getString("CF_Name"));
    jLabel2.setText(res.getString("CF_Address_1"));
    jLabel3.setText(res.getString("CF_City_StateProv"));
    jLabel4.setText(res.getString("CF_Phone"));
    jLabel5.setText(res.getString("CF_EMail"));
    jLabel6.setText(res.getString("CF_Fax"));
    jLabel7.setText(res.getString("CF_Address_2"));
    jLabel8.setText(res.getString("CF_Country"));
    jLabel9.setText(res.getString("CF_First"));
    jLabel10.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel10.setText(res.getString("CF_MI"));
    jLabel11.setText(res.getString("CF_Last"));
    jLabel12.setText(res.getString("CF_Postal_Code"));
    jdbStatusLabel1.setOpaque(true);
    jdbStatusLabel1.setDataSet(dm.getCustomerDataSet());
    btnViewOrder.setText(res.getString("CF_View_Order"));
    btnViewOrder.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        btnViewOrder_actionPerformed(e);
      }
    });
    lblOrders.setText(res.getString("CF_Orders_placed_by_this"));
    btnClose.setText(res.getString("CF_Close"));
    btnClose.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        btnClose_actionPerformed(e);
      }
    });
    btnNewOrder.setText(res.getString("CF_New_Order"));
    imageLabel1.setIcon(new ImageIcon(this.getClass().getResource("images/customerBanner.jpg")));
    imageLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel6.setHorizontalAlignment(SwingConstants.CENTER);
    btnNewOrder.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        btnNewOrder_actionPerformed(e);
      }
    });
    jPanel1.setLayout(gridLayout1);
    gridLayout1.setColumns(2);
    gridLayout1.setHgap(5);
    contentPane.add(jPanel2, BorderLayout.NORTH);
    contentPane.add(pnlMain, BorderLayout.CENTER);
    contentPane.add(jdbStatusLabel1, BorderLayout.SOUTH);
    pnlMain.add(pnlCustomerInfo, new GridBagConstraints(0, 0, 1, 1, 100.0, 0.0
            ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    pnlCustomerInfo.add(txtFirstName, new GridBagConstraints(6, 1, 2, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 112, 0));
    pnlCustomerInfo.add(txtMI, new GridBagConstraints(8, 1, 2, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), -60, 0));
    pnlCustomerInfo.add(txtLastName, new GridBagConstraints(10, 1, 3, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 4), 107, 0));
    pnlCustomerInfo.add(txtAddr1, new GridBagConstraints(6, 2, 6, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 6, 0, 4), 224, 0));
    pnlCustomerInfo.add(txtAddr2, new GridBagConstraints(6, 3, 6, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 4), 224, 0));
    pnlCustomerInfo.add(txtCity, new GridBagConstraints(6, 4, 2, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 108, 0));
    pnlCustomerInfo.add(txtState, new GridBagConstraints(8, 4, 4, 1, 0.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 18, 0));
    pnlCustomerInfo.add(txtPostalCode, new GridBagConstraints(6, 5, 2, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 108, 0));
    pnlCustomerInfo.add(txtCountry, new GridBagConstraints(6, 6, 2, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 107, 0));

⌨️ 快捷键说明

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