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

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

?? vipshoppingframe.java

?? 包括8個項目示例
?? 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在线观看高清| 国产成人福利片| 成人黄动漫网站免费app| jizz一区二区| 91女厕偷拍女厕偷拍高清| 日本电影欧美片| 欧美在线看片a免费观看| 欧美日韩免费一区二区三区视频| 欧美写真视频网站| 欧美猛男男办公室激情| 欧美男同性恋视频网站| 91精品一区二区三区在线观看| 欧美乱熟臀69xxxxxx| 日韩亚洲国产中文字幕欧美| 26uuu亚洲| 国产精品午夜在线| 香蕉久久夜色精品国产使用方法 | 亚洲尤物在线视频观看| 午夜伦理一区二区| 久久国产精品无码网站| 成人午夜伦理影院| 欧美午夜精品久久久久久孕妇| 欧美日本视频在线| 久久精品免视看| 一区二区三区在线视频免费| 秋霞午夜av一区二区三区| 国产成人精品1024| 欧美日本在线观看| 国产欧美日韩在线| 日韩福利视频导航| 成人涩涩免费视频| 91麻豆精品国产无毒不卡在线观看 | 精品亚洲成a人| 91免费在线看| wwwwww.欧美系列| 夜夜嗨av一区二区三区网页 | 色哟哟一区二区在线观看| 日韩免费高清av| 亚洲人亚洲人成电影网站色| 天堂蜜桃91精品| 99久久精品国产观看| 日韩一卡二卡三卡四卡| 伊人色综合久久天天| 国产精品白丝av| 欧美一区二区在线看| 中文字幕日韩一区二区| 美女视频黄 久久| 欧美色综合天天久久综合精品| 精品久久久久久久久久久院品网| 亚洲精品视频在线观看网站| 国产乱国产乱300精品| 欧美日韩激情一区二区三区| 国产精品电影一区二区三区| 玖玖九九国产精品| 精品污污网站免费看| 国产精品电影一区二区| 国产揄拍国内精品对白| 在线成人午夜影院| 亚洲444eee在线观看| 91在线播放网址| 国产精品激情偷乱一区二区∴| 国产一区二区0| 精品少妇一区二区三区日产乱码 | 亚洲精品中文在线| 99国内精品久久| 日韩一区欧美一区| 成人免费福利片| 欧美国产日韩精品免费观看| 激情综合一区二区三区| 欧美成人一区二区三区片免费 | 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 麻豆91在线播放免费| 91精品啪在线观看国产60岁| 亚洲最快最全在线视频| 日本精品免费观看高清观看| 最新国产精品久久精品| 99久久精品国产一区| 亚洲视频免费观看| 欧美无砖砖区免费| 香蕉成人啪国产精品视频综合网| 欧亚洲嫩模精品一区三区| 一二三区精品视频| 在线不卡中文字幕播放| 奇米影视7777精品一区二区| 欧美一区二区精品在线| 国产精品自产自拍| 中文字幕中文在线不卡住| av一区二区三区| 一区二区成人在线视频| 欧美精品久久99| 久久99国产精品免费网站| 久久久久久久综合日本| www.成人网.com| 午夜免费久久看| 久久久久88色偷偷免费| 91丨九色丨蝌蚪富婆spa| 亚洲午夜免费视频| 日韩欧美色综合| 99久久伊人精品| 五月天激情综合| 2020国产成人综合网| 99视频在线观看一区三区| 亚洲最新视频在线观看| 欧美变态tickling挠脚心| 成人免费视频一区二区| 亚洲成人av一区| 久久精品视频一区| 欧美视频一区二区| 国精产品一区一区三区mba桃花| 最新国产精品久久精品| 日韩欧美中文字幕公布| 91在线国产福利| 国产麻豆精品95视频| 亚洲一区在线观看视频| 国产三级久久久| 3atv在线一区二区三区| 99re热这里只有精品视频| 免费成人av在线| 亚洲一二三区不卡| 国产精品午夜久久| 欧美mv日韩mv亚洲| 欧美日韩久久不卡| www.久久久久久久久| 九九国产精品视频| 午夜伦理一区二区| 亚洲精品成人a在线观看| 亚洲国产精品精华液ab| 欧美一区二区三区精品| 在线免费亚洲电影| 成人av资源在线| 国产精品一区二区在线播放 | 亚洲电影视频在线| 亚洲精品成a人| 国产精品国产三级国产有无不卡| 日韩欧美国产系列| 91精品国产免费| 51精品久久久久久久蜜臀| 欧美亚洲动漫制服丝袜| 99re8在线精品视频免费播放| 国产成人综合在线观看| 国产综合久久久久久久久久久久| 亚洲成人av中文| 视频一区视频二区在线观看| 一区二区三区在线观看国产| 亚洲私人黄色宅男| 亚洲丝袜自拍清纯另类| 亚洲欧美一区二区久久 | 青青草一区二区三区| 亚洲va韩国va欧美va| 亚洲成人精品一区二区| 亚洲与欧洲av电影| 91丨porny丨在线| 91精品国产色综合久久ai换脸| 盗摄精品av一区二区三区| 国产一区二区影院| 国产福利精品一区| 国产精品综合网| youjizz久久| 色视频一区二区| 欧美日韩国产欧美日美国产精品| 欧美酷刑日本凌虐凌虐| 制服丝袜亚洲色图| 精品动漫一区二区三区在线观看| 精品国产乱码久久久久久蜜臀| 精品999久久久| 国产精品免费视频一区| 亚洲精品日产精品乱码不卡| 亚洲综合在线观看视频| 日韩精品一区第一页| 老司机精品视频线观看86| 国产一区二区三区免费播放| 国产高清在线精品| 91小视频在线| 91.麻豆视频| 国产午夜亚洲精品理论片色戒 | 欧美老人xxxx18| 2017欧美狠狠色| 亚洲蜜臀av乱码久久精品蜜桃| 日韩在线卡一卡二| 国产激情视频一区二区三区欧美| 色综合天天做天天爱| 日韩一级免费观看| 亚洲色图欧洲色图婷婷| 亚洲18影院在线观看| 风间由美一区二区三区在线观看| 91久久精品一区二区| 日韩一区二区三区高清免费看看| 中文字幕av一区二区三区免费看 | 欧美色男人天堂| 欧美xxxxxxxx| 一区二区三区欧美视频| 精品一区二区三区免费播放| 91在线免费看| 久久久久久久久久久黄色| 亚洲一区二区三区四区在线观看 | 国产99久久久国产精品| 欧洲一区二区av| 日本一区二区动态图|