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

📄 frm_add_edit_warehouse.java

📁 《JBuilder编程技术与实例》(2006 四维科技 人民邮电)赠送代码——库存管理系统(Access)
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package MainForm;

/*
********************************************************************************
*																			   *
* Note:																		   *
*      This is not intended to used in a big business because this system was  *
*      created for small business only.
* 																			   *
********************************************************************************
*/

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

public class frm_add_edit_warehouse extends JDialog{
        JButton JBUpdate = new JButton(new ImageIcon("images/save.png"));
        JButton JBReset = new JButton("Reset",new ImageIcon("images/reset.png"));
        JButton JBCancel = new JButton("Cancel",new ImageIcon("images/cancel.png"));

        JLabel JLPic1 = new JLabel();
        JLabel JLBanner = new JLabel("Please fill-up all the required fields.");

        JLabel JLId = new JLabel("Warehouse ID:");
        JLabel JLName = new JLabel("Warehouse Name:");
        JLabel JLCPerson = new JLabel("Contact Person:");
        JLabel JLCTitle = new JLabel("Contact Title:");
        JLabel JLAddr = new JLabel("Address:");
        JLabel JLCity = new JLabel("CityTown:");
        JLabel JLStateProv = new JLabel("State/Province:");
        JLabel JLZipCode = new JLabel("Zip Code:");
        JLabel JLPhone = new JLabel("Phone:");
        JLabel JLFax = new JLabel("Fax:");

        JTextField JTFId = new JTextField();
        JTextField JTFName = new JTextField();
        JTextField JTFCPerson = new JTextField();
        JTextField JTFCTitle = new JTextField();
        JTextField JTFAddr = new JTextField();
        JTextField JTFCity = new JTextField();
        JTextField JTFStateProv = new JTextField();
        JTextField JTFZipCode = new JTextField();
        JTextField JTFPhone = new JTextField();
        JTextField JTFFax = new JTextField();

        Connection cnAEW;
        Statement stAEW;
        ResultSet rsAEW;

        Dimension screen = 	Toolkit.getDefaultToolkit().getScreenSize();

        boolean ADDING_STATE;

        public frm_add_edit_warehouse(boolean ADD_STATE,JFrame OwnerForm,Connection srcCN,String srcSQL){
                super(OwnerForm,true);
                cnAEW = srcCN;
                ADDING_STATE = ADD_STATE;
                try{
                        stAEW = cnAEW.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
                }catch( SQLException sqlEx){

                }
                if(ADD_STATE==true){
                        JLPic1.setIcon(new ImageIcon("images/bNew.png"));
                        setTitle("Add New Warehouse");
                        JBUpdate.setText("Update");
                }else{
                        JLPic1.setIcon(new ImageIcon("images/bModify.png"));
                        setTitle("Modify Warehouse");
                        JBUpdate.setText("Save");
                        try{
                                rsAEW = stAEW.executeQuery(srcSQL);
                                rsAEW.next();
                                        JTFId.setText("" + rsAEW.getString("WarehouseID"));
                                        JTFName.setText("" + rsAEW.getString("WarehouseName"));
                                        JTFCPerson.setText("" + rsAEW.getString("ContactPerson"));
                                        JTFCTitle.setText("" + rsAEW.getString("ContactTitle"));
                                        JTFAddr.setText("" + rsAEW.getString("Address"));
                                        JTFCity.setText("" + rsAEW.getString("CityTown"));
                                        JTFStateProv.setText("" + rsAEW.getString("StateProvince"));
                                        JTFZipCode.setText("" + rsAEW.getString("ZipCode"));
                                        JTFPhone.setText("" + rsAEW.getString("Phone"));
                                        JTFFax.setText("" + rsAEW.getString("Fax"));
                        }catch(SQLException sqlEx){
                                System.out.println(sqlEx.getMessage());
                        }
                }
                JPanel JPContainer = new JPanel();
                JPContainer.setLayout(null);
                //-- Add the JLPic1
                JLPic1.setBounds(5,5,32,32);
                JPContainer.add(JLPic1);

                //-- Add the JLBanner
                JLBanner.setBounds(55,5,268,48);
                JLBanner.setFont(new Font("Dialog",Font.PLAIN,12));
                JPContainer.add(JLBanner);

                //******************** Start adding of input field
                //-- Add Id Input Field
                JLId.setBounds(5,50,105,20);
                JLId.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFId.setBounds(110,50,200,20);
                JTFId.setFont(new Font("Dialog",Font.PLAIN,12));

                JPContainer.add(JLId);
                JPContainer.add(JTFId);

                //-- Add Name Input Field
                JLName.setBounds(5,72,105,20);
                JLName.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFName.setBounds(110,72,200,20);
                JTFName.setFont(new Font("Dialog",Font.PLAIN,12));

                JPContainer.add(JLName);
                JPContainer.add(JTFName);

                //-- Add Contact Person Input Field
                JLCPerson.setBounds(5,94,105,20);
                JLCPerson.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFCPerson.setBounds(110,94,200,20);
                JTFCPerson.setFont(new Font("Dialog",Font.PLAIN,12));

                JPContainer.add(JLCPerson);
                JPContainer.add(JTFCPerson);

                //-- Add Primary Address Input Field
                JLCTitle.setBounds(5,116,105,20);
                JLCTitle.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFCTitle.setBounds(110,116,200,20);
                JTFCTitle.setFont(new Font("Dialog",Font.PLAIN,12));

                JPContainer.add(JLCTitle);
                JPContainer.add(JTFCTitle);

                //-- Add Secondary Address Input Field
                JLAddr.setBounds(5,138,105,20);
                JLAddr.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFAddr.setBounds(110,138,200,20);
                JTFAddr.setFont(new Font("Dialog",Font.PLAIN,12));

                JPContainer.add(JLAddr);
                JPContainer.add(JTFAddr);

                //-- Add CityTown Input Field
                JLCity.setBounds(5,160,105,20);
                JLCity.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFCity.setBounds(110,160,200,20);
                JTFCity.setFont(new Font("Dialog",Font.PLAIN,12));

                JPContainer.add(JLCity);
                JPContainer.add(JTFCity);

                //-- Add StateProvince Input Field
                JLStateProv.setBounds(5,182,105,20);
                JLStateProv.setFont(new Font("Dialog",Font.PLAIN,12));

                JTFStateProv.setBounds(110,182,200,20);

⌨️ 快捷键说明

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