亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vipshoppingframe.java

?? 來源:www.tqbooks.net包括八個項目 自制聊天室等
?? JAVA
字號:
import java.sql.*; 
import javax.swing.*; 
//import javax.swing.event.*;
import java.awt.*; 
import java.awt.event.*; 
import java.util.*; 
import java.lang.*; 

public class VipShoppingFrame extends JDialog 
{
	private Connection Shoppingconnection; 
   	private Statement Shoppingstatement; 
   	private Statement VIPNamestatement; 
   	private Statement InsertInputstatement; 
   	private ResultSet ShoppingresultSet; 
   	private ResultSet VIPNameresultSet; 
   	
   	private ResultSetMetaData rsMetaData;
   
    
    //GUI變量定義
	private JLabel VipSerialLabel ;
	private JLabel VipNameLabel ;
	private JLabel VipCommoditySerialLabel ;
	private JLabel VipCommodityNameLabel ;
	private JLabel VipCommodityPriceLabel ;
	private JLabel VipCommodityRealPriceLabel ;
	
   	private JTextField VipSerialField;
   	private JTextField VipNameField;
   	private JTextField VipCommoditySerialField;
   	private JTextField VipCommodityNameField;
   	private JTextField VipCommodityPriceField;
   	private JTextField VipCommodityRealPriceField;
	
	private JButton SubmmitButton ;
	private JButton cancelButton ;
	private JFrame parent; 
    
    public VipShoppingFrame(JFrame parent, boolean modal) 
    {
        super(parent, modal);
        this.parent = parent;
        pack();
        
        initComponents(); 
        DatabaseConnection();
    }
    private void initComponents() 
    {
    	GridBagLayout layout = new GridBagLayout();
        Container contents = getContentPane();
        contents.setLayout(layout);

        GridBagConstraints constraints = new GridBagConstraints();

        setTitle ("VIP購物信息錄入窗口");
        addWindowListener(new WindowAdapter () 
        {
            public void windowClosing(WindowEvent event) 
            {
                setVisible(false);
        		dispose();
            }
        });
        
        VipSerialField = new JTextField(); // needed below
        VipSerialField.setPreferredSize(new Dimension(150, 25));
        VipSerialLabel = new JLabel();
        VipSerialLabel.setText("V  I  P   號:        ");
        VipSerialLabel.setLabelFor(VipSerialField);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 0;
        constraints.gridy = 0;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        contents.add(VipSerialLabel, constraints);
        constraints.gridx = 1;
        constraints.gridy = 0;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        contents.add(VipSerialField, constraints);
        
        VipSerialField.addKeyListener (new java.awt.event.KeyAdapter()
        {
            public void keyReleased(KeyEvent e) 
            {
                
                ShowVipName();
                
            }
        });
        //2
        VipNameField = new JTextField(); // needed below
        VipNameField.setPreferredSize(new Dimension(150, 25));
        VipNameField.setEditable(false);
        //VipNameField.setBorder(BorderFactory.createLoweredBevelBorder());
        VipNameLabel = new JLabel();
        VipNameLabel.setText("會 員 姓 名:        ");
        VipNameLabel.setLabelFor(VipNameField);
        constraints.gridx = 0;
        constraints.gridy = 1;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        contents.add(VipNameLabel, constraints);
        constraints.gridx = 1;
        constraints.gridy = 1;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        contents.add(VipNameField, constraints);
        //3
        VipCommoditySerialField = new JTextField(); // needed below
        VipCommoditySerialField.setPreferredSize(new Dimension(150, 25));
        VipCommoditySerialLabel = new JLabel();
        VipCommoditySerialLabel.setText("商 品 標 號:        ");
        VipCommoditySerialLabel.setLabelFor(VipCommoditySerialField);
        constraints.gridx = 0;
        constraints.gridy = 2;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        contents.add(VipCommoditySerialLabel, constraints);
        constraints.gridx = 1;
        constraints.gridy = 2;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        contents.add(VipCommoditySerialField, constraints);
       
        VipCommoditySerialField.addKeyListener (new java.awt.event.KeyAdapter()
        {
            public void keyReleased(KeyEvent e) 
            {
                
                ShowPrice();
                
            }
        });
        //4
        VipCommodityNameField = new JTextField(); // needed below
        VipCommodityNameField.setPreferredSize(new Dimension(150, 25));
        VipCommodityNameField.setEditable(false);
        VipCommodityNameLabel = new JLabel();
        VipCommodityNameLabel.setText("商 品 名 稱:        ");
        VipCommodityNameLabel.setLabelFor(VipCommodityNameField);
        constraints.gridx = 0;
        constraints.gridy = 3;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        contents.add(VipCommodityNameLabel, constraints);
        constraints.gridx = 1;
        constraints.gridy = 3;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        contents.add(VipCommodityNameField, constraints);   
		//5
		VipCommodityPriceField = new JTextField(); // needed below
        VipCommodityPriceField.setPreferredSize(new Dimension(150, 25));
        VipCommodityPriceField.setEditable(false);
        VipCommodityPriceLabel = new JLabel();
        VipCommodityPriceLabel.setText("商 品 價 格:        ");
        VipCommodityPriceLabel.setLabelFor(VipCommodityPriceField);
        constraints.gridx = 0;
        constraints.gridy = 4;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        contents.add(VipCommodityPriceLabel, constraints);
        constraints.gridx = 1;
        constraints.gridy = 4;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        contents.add(VipCommodityPriceField, constraints);    
        //6
		VipCommodityRealPriceField = new JTextField(); // needed below
        VipCommodityRealPriceField.setPreferredSize(new Dimension(150, 25));
        VipCommodityRealPriceField.setEditable(false);
        VipCommodityRealPriceLabel = new JLabel();
        VipCommodityRealPriceLabel.setText("實 收 價 格:        ");
        VipCommodityRealPriceLabel.setLabelFor(VipCommodityRealPriceField);
        constraints.gridx = 0;
        constraints.gridy = 5;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        contents.add(VipCommodityRealPriceLabel, constraints);
        constraints.gridx = 1;
        constraints.gridy = 5;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        contents.add(VipCommodityRealPriceField, constraints); 
        
        JPanel buttonPanel = createButtonPanel(); // sets global loginButton
        constraints.gridx = 0;
        constraints.gridy = 6;
        constraints.gridwidth = 3;
        constraints.gridheight = 2;
        contents.add(buttonPanel, constraints);
        
        setSize( 450, 280 );
      	setResizable(false);
      	setLocation(200,100);	
    }
    
     private JPanel createButtonPanel() {

        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, 0));
        //panel.setSize( 490, 40 );
        //panel.setBorder(BorderFactory.createEtchedBorder());

        // login button (global variable)
        SubmmitButton = new JButton();
        SubmmitButton.setText("確  定");
        
        SubmmitButton.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent event) 
            {
                VipShoppingInfoInput();
            }
        });
        panel.add(SubmmitButton);

        // space
        panel.add(Box.createRigidArea(new Dimension(200,0)));

        // cancel button
        JButton cancelButton = new JButton();
        cancelButton.setText("返  回");
        
        cancelButton.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent event) 
            {
                dispose();
            }
        });
        panel.add(cancelButton);

        // space
        

        Vector buttons = new Vector(2);
        buttons.add(SubmmitButton);
        buttons.add(cancelButton);
        equalizeComponentSizes(buttons);
        buttons.removeAllElements(); // simplify gc
        return panel;
    } // createButtonPanel()


    private void equalizeComponentSizes(java.util.List components) {

        // Get the largest width and height
        int i = 0;
        Dimension maxPreferred = new Dimension(0,0);
        JComponent oneComponent = null;
        Dimension thisPreferred = null;
        for (i = 0; i < components.size(); ++i) {
            oneComponent = (JComponent)components.get(i);
            thisPreferred = oneComponent.getPreferredSize();
            maxPreferred.width =
                Math.max(maxPreferred.width, (int)thisPreferred.getWidth());
            maxPreferred.height =
                Math.max(maxPreferred.height, (int)thisPreferred.getHeight());
        }

        // reset preferred and maximum size since BoxLayout takes both
        // into account
        for (i = 0; i < components.size(); ++i) {
            oneComponent = (JComponent)components.get(i);
            oneComponent.setPreferredSize((Dimension)maxPreferred.clone());
            oneComponent.setMaximumSize((Dimension)maxPreferred.clone());
        }
    } // equalizeComponentSizes()
    
    private void ShowPrice()
    {
    	if(VipCommoditySerialField.getText().equals(""))
    	{
			return ;
		}    	
    	try
    	{
    		String CommodityQuery = "select 商品名稱,商品價格,商品折扣 from COMMODITY_ID where 商品編號 = "+VipCommoditySerialField.getText()+"";
    		String CommodityName;
    		String CommodityPrice;
        	String CommodityDiscount;
      		String CommodityRealPrice;
      		
      		float  price;
      		float  discount;
      		float  realprice;
    		Shoppingstatement = Shoppingconnection.createStatement();
    		ShoppingresultSet = Shoppingstatement.executeQuery( CommodityQuery ); 
    	
    		boolean moreRecords = ShoppingresultSet.next();  
    		if ( !moreRecords ) 
      		{ 
         		JOptionPane.showMessageDialog( this,"對不起,無此商品號,請重新輸入" ); 
         		//setTitle( "無記錄顯示" );
         		//VipCommoditySerialField.setText("");
         		VipCommodityNameField.setText("");
      			VipCommodityPriceField.setText("");
      			VipCommodityRealPriceField.setText("");
           		return; 
      		}  
      		CommodityName = ShoppingresultSet.getString( 1 );
      		CommodityPrice = ShoppingresultSet.getString( 2 );
      		CommodityDiscount = ShoppingresultSet.getString( 3 );
      		 
      		price = Float.parseFloat(CommodityPrice);
      		discount = Float.parseFloat(CommodityDiscount);
      		realprice = price*discount;
      		CommodityRealPrice = Float.toString(realprice);
      		
      		VipCommodityNameField.setText(CommodityName);
      		VipCommodityPriceField.setText(CommodityPrice);
      		VipCommodityRealPriceField.setText(CommodityRealPrice);
    	}
    	catch ( SQLException sqlex ) 
      	{ 
        	sqlex.printStackTrace(); 
      	}  
    }
    private void ShowVipName()
    {
    	if(VipSerialField.getText().equals(""))
    	{
			return ;
		}    	
    	
    	String VipNameQuery = "select 姓名 from VIPID where VIP編號 = "+VipSerialField.getText()+"";      		
      	String VipName;
      
      	try
      	{
      		VIPNamestatement  = Shoppingconnection.createStatement();
        	VIPNameresultSet  = VIPNamestatement.executeQuery( VipNameQuery ); 
        
        	boolean moreRecords1 = VIPNameresultSet.next(); 
         	 
      		if ( !moreRecords1 ) 
      		{ 
        	 	JOptionPane.showMessageDialog( this,"對不起,無此會員號,請重新輸入" ); 
        	 		//setTitle( "無記錄顯示" );
        	 	//VipSerialField.setText("");
        	 	VipNameField.setText("");
        	 	return; 
      		}  
      		VipName = VIPNameresultSet.getString( 1 );
      		VipNameField.setText(VipName);
      	}
        catch ( SQLException sqlex ) 
      	{ 
        	sqlex.printStackTrace(); 
      	}  
    }
    private void VipShoppingInfoInput()
    {
    	if(
   		   VipSerialField.getText().equals( "" )||
   		   VipNameField.getText().equals("")||
   		   VipCommoditySerialField.getText().equals( "" )||
   		   VipCommodityNameField.getText().equals( "" )||
   		   VipCommodityPriceField.getText().equals( "" )||
   		   VipCommodityRealPriceField.getText().equals( "" ))
   		{
   			JOptionPane.showMessageDialog( this,"請填會員購物資料" ); 
         	//setTitle( "無記錄顯示" ); 
         	return; 	
   		}
   		
      	try 
      	{ 
      		 String ShoppingInput = "insert into CONSUME VALUES("
      		 					+VipSerialField.getText()+",'"+VipNameField.getText()+"',"
      		 					+VipCommoditySerialField.getText()+",'"+VipCommodityNameField.getText()+"',"
      		 					+VipCommodityPriceField.getText()+","+VipCommodityRealPriceField.getText()+")";
      		 Shoppingstatement = Shoppingconnection.createStatement();
      		 int insert = Shoppingstatement.executeUpdate( ShoppingInput );//executeUpdate返回一個整型值
      		 
      		 if (insert == 1)
      		 {
      		 	JOptionPane.showMessageDialog( this,"VIP用戶購物信息登記成功!" );
      		 	VipSerialField.setText("");
   		   		VipNameField.setText("");
   		   		VipCommoditySerialField.setText("");
   		   		VipCommodityNameField.setText("");
   		   		VipCommodityPriceField.setText("");
   		   		VipCommodityRealPriceField.setText("");
   		   	
    		 } 
      	} 
      	catch ( SQLException sqlex ) 
      	{ 
        	sqlex.printStackTrace(); 
      	}  
        
   		    
    }
     private void DatabaseConnection()
     {
     	String url = "jdbc:odbc:VipQuery"; 
    	String username = ""; 
    	String password = ""; 
    	
    	
    	//加載驅動程序以連接數據庫
      	try 
      	{ 
        	Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ); 
        	Shoppingconnection = DriverManager.getConnection( url, username, password ); 
      	} 
      	//捕獲加載驅動程序異常
      	catch ( ClassNotFoundException cnfex ) 
      	{ 
        	System.err.println("裝載 JDBC/ODBC 驅動程序失敗。" ); 
        	cnfex.printStackTrace(); 
         	System.exit( 1 );  // terminate program 
      	} 
      	//捕獲連接數據庫異常
      	catch ( SQLException sqlex ) 
      	{ 
         	System.err.println( "無法連接數據庫" ); 
         	sqlex.printStackTrace(); 
         	System.exit( 1 );  // terminate program 
      	}
     }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91成人在线免费观看| 久久综合九色综合97婷婷女人| 中文字幕国产一区| 成人免费的视频| 中文字幕国产一区| 91亚洲午夜精品久久久久久| 亚洲精品国产第一综合99久久| 欧洲色大大久久| 日韩一区精品视频| 久久精品夜色噜噜亚洲a∨| 成人高清免费观看| 亚洲五码中文字幕| 精品国产伦一区二区三区观看方式| 国精产品一区一区三区mba桃花| 中文字幕av一区二区三区免费看| 成人av资源在线| 亚洲尤物视频在线| 久久综合色一综合色88| 色综合天天性综合| 麻豆一区二区三| 国产精品二区一区二区aⅴ污介绍| 日本韩国精品在线| 狠狠色丁香久久婷婷综合丁香| 国产精品亲子乱子伦xxxx裸| 欧美在线一二三四区| 久久99精品国产麻豆婷婷洗澡| 国产精品免费久久| 制服丝袜亚洲精品中文字幕| 国产福利一区二区三区视频在线 | 成人av在线观| 一区二区三区小说| 欧美精品一区二区三区一线天视频 | 欧美三电影在线| 国产福利精品一区二区| 亚洲国产精品久久人人爱蜜臀| 久久久久久久久99精品| 欧美另类高清zo欧美| hitomi一区二区三区精品| 久久精品国产一区二区三区免费看| 中文字幕日韩一区| 精品99999| 欧美日韩国产一二三| 成人av综合在线| 国产又粗又猛又爽又黄91精品| 亚洲.国产.中文慕字在线| 欧美国产综合一区二区| 欧美成人一区二区| 欧美午夜精品电影| 91日韩精品一区| 国产一区二区三区黄视频 | 亚洲视频一区二区在线观看| 日韩欧美国产一区二区在线播放| 91极品美女在线| 成人aa视频在线观看| 国产精品1区二区.| 久色婷婷小香蕉久久| 日本系列欧美系列| 亚洲aⅴ怡春院| 亚洲国产视频一区二区| 亚洲欧洲综合另类| 中文在线一区二区| 久久精品在线观看| 久久精品在线观看| 国产午夜精品一区二区| 精品欧美一区二区久久 | 久久91精品久久久久久秒播| 日韩中文字幕不卡| 午夜精品久久久久影视| 午夜在线电影亚洲一区| 亚洲成人自拍网| 亚洲一区二区三区精品在线| 伊人开心综合网| 亚洲欧美偷拍另类a∨色屁股| 国产精品久久久久久久久久久免费看| 久久蜜桃香蕉精品一区二区三区| 精品日韩在线观看| 久久女同精品一区二区| 国产人妖乱国产精品人妖| 久久精品男人天堂av| 久久精品视频网| 国产色爱av资源综合区| 欧美经典三级视频一区二区三区| 久久影院电视剧免费观看| 久久久久国产精品麻豆ai换脸| 久久精品夜色噜噜亚洲aⅴ| 久久久久久久久久久久久夜| 国产色综合一区| 亚洲欧美一区二区三区极速播放| 一区av在线播放| 美脚の诱脚舐め脚责91 | 国产一区在线看| 成人综合日日夜夜| 99视频精品在线| 在线观看成人免费视频| 91精品国产色综合久久 | 日本一区二区三区国色天香| 中文字幕亚洲区| 亚洲高清视频中文字幕| 九九九精品视频| 国产成人亚洲精品狼色在线| a美女胸又www黄视频久久| 欧美三区在线观看| 精品成人一区二区三区四区| 中文字幕视频一区二区三区久| 亚洲午夜久久久久久久久电影院| 日本午夜一本久久久综合| 国产剧情一区在线| 91高清视频在线| 欧美精品一区二区三区四区| 亚洲欧美在线视频| 日本午夜一区二区| aaa亚洲精品一二三区| 欧美体内she精视频| 久久久久久免费网| 亚洲一区二区三区在线看| 精品无人码麻豆乱码1区2区| 色综合久久久网| 精品卡一卡二卡三卡四在线| 亚洲人成在线播放网站岛国| 麻豆成人综合网| 色偷偷88欧美精品久久久| 精品国产91九色蝌蚪| 亚洲一区二区三区中文字幕| 国产福利视频一区二区三区| 欧美性做爰猛烈叫床潮| 久久精品人人做人人综合 | 欧美精品久久一区二区三区| 欧美成人a在线| 亚洲自拍偷拍网站| 国产高清在线精品| 欧美一级搡bbbb搡bbbb| 亚洲人成网站精品片在线观看 | 亚洲国产精品国自产拍av| 亚洲国产精品一区二区久久| www.亚洲在线| 26uuu国产电影一区二区| 五月天精品一区二区三区| 99re这里都是精品| 国产午夜亚洲精品不卡| 久久精品99久久久| 777奇米成人网| 亚洲午夜私人影院| 99在线视频精品| 久久久久久久久蜜桃| 久久se这里有精品| 3d动漫精品啪啪1区2区免费| 亚洲福利一区二区三区| 色拍拍在线精品视频8848| 中文字幕在线观看不卡视频| 国产精品一二三| 欧美v国产在线一区二区三区| 日本欧美在线观看| 欧美日本国产一区| 亚洲成人777| 欧美日本韩国一区二区三区视频| 一区二区三区在线影院| 色老汉av一区二区三区| 亚洲欧美aⅴ...| 色综合色综合色综合色综合色综合 | 亚洲国产精品一区二区www| 91丨九色丨蝌蚪丨老版| 国产精品久久久久久亚洲伦| 成人免费三级在线| 欧美国产一区在线| 成人av动漫网站| 国产精品乱码久久久久久| 成人中文字幕合集| 欧美国产日韩a欧美在线观看| 成人动漫在线一区| 中文字幕一区二区三| 97久久超碰国产精品| 亚洲色图另类专区| 欧美视频日韩视频| 午夜精品福利视频网站| 在线不卡欧美精品一区二区三区| 亚洲 欧美综合在线网络| 日韩午夜小视频| 久久国产人妖系列| 国产午夜精品久久| 99久久婷婷国产综合精品电影| 国产精品久线观看视频| 在线观看成人免费视频| 日韩中文字幕1| 久久亚洲精华国产精华液| 国产激情精品久久久第一区二区| 国产精品网曝门| 91久久精品一区二区二区| 日日欢夜夜爽一区| 26uuu色噜噜精品一区二区| 成人18视频在线播放| 亚洲日本一区二区| 制服丝袜中文字幕亚洲| 国产一区二区中文字幕| 专区另类欧美日韩| 欧美日韩不卡一区| 国产一区二区女| 亚洲乱码国产乱码精品精小说| 欧美日韩在线直播| 国产综合久久久久影院| 一区二区三区蜜桃网|