資源簡(jiǎn)介
僅用了java+sql做了一個(gè)簡(jiǎn)單的庫(kù)存管理軟件,包括入庫(kù)出庫(kù)等操作
代碼片段和文件信息
package?inventory;
import?java.awt.*;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.ItemEvent;
import?java.awt.event.ItemListener;
import?java.awt.event.MouseEvent;
import?java.awt.event.MouseListener;
import?java.sql.*;
import?javax.swing.*;
public?class?AddCustomer?{
JPanel?panel;
JLabel?CustomerNameCustomerPerSonCustomerTelCustomerPhoneCustomerCodeCustomerPostNoCustomerAddress;//供應(yīng)商名稱,聯(lián)系人,手機(jī)電話,傳真,郵編號(hào),地址
JTextField??txtNametxtPerSontxtTeltxtPhonetxtCodetxtPostNotxtosttxtnext;
JComboBox?city1city2city3;//省,市,區(qū)/縣
JButton?add;
SqlHelper?help;
public??AddCustomer()
{
panel=new?JPanel(null);
panel.setBorder(null);
panel.setBackground(new?Color(100000));
panel.setBounds(1020980560);
double?a=panel.getBounds().width?*?0.1;
//標(biāo)簽
CustomerName=new?JLabel(“客??戶??名??稱:“);
CustomerName.setBounds(1002010030);
CustomerPerSon=new?JLabel(“客?戶?聯(lián)?系?人:“);
CustomerPerSon.setBounds(3202010030);
CustomerTel=new?JLabel(“客??戶??電???話:“);
CustomerTel.setBounds(5402010030);
CustomerPhone=new?JLabel(“客??戶???手???機(jī):“);
CustomerPhone.setBounds(1006010030);
CustomerCode=new?JLabel(“客??戶??傳???真:“);
CustomerCode.setBounds(3206010030);
CustomerPostNo=new?JLabel(“客??戶??郵???編:“);
CustomerPostNo.setBounds(5406010030);
CustomerAddress=new?JLabel(“客??戶??地???址:“);
CustomerAddress.setBounds(10010010030);
//文本框
txtName=new?JTextField();
txtName.setBounds(2002510025);
txtPerSon=new?JTextField();
txtPerSon.setBounds(4202510025);
txtTel=new?JTextField();
txtTel.setBounds(6252510025);
txtPhone=new?JTextField();
txtPhone.setBounds(2006510025);
txtCode=new?JTextField();
txtCode.setBounds(4206510025);
txtPostNo=new?JTextField();
txtPostNo.setBounds(6256510025);
txtost=new?JTextField(“請(qǐng)輸入街道地址“);
txtost.setBounds(545?100?200?25);
txtnext=new?JTextField();
txtnext.setBounds(545?100?200?25);
city1=new?JComboBox();
????city1=new?JComboBox();
????city1.setBounds(21010010025);
????city2=new?JComboBox();
????city2.setBounds(32010010025);
????city3=new?JComboBox();
????city3.setBounds(42510010025);
????city1.addItem(“湖南省“);
????city1.addItem(“湖北省“);
????
????//事件
????city1.addItemListener(new?ItemListener()?{
@Override
public?void?itemStateChanged(ItemEvent?e)?{
//?TODO?Auto-generated?method?stub
String?address[]={?“長(zhǎng)沙市““株洲市““岳陽(yáng)市“};?
String?address2[]={“武漢市““黃石市““宜昌市“};
?if(e.getStateChange()!=ItemEvent.SELECTED)
?{
?return;
?}
?????city2.removeAllItems();
?????if(city1.getSelectedItem()==“湖南省“){
?for?(int?i?=?0;?i? city2.addItem(address[i]);
}
?}??
?????else?{???
???? ???for?(int?i?=?0;?i? ???? ???{
?city2.addItem(address2[i]);
???}
??????}
}
});?
??????city2.addItemListener(new?ItemListener
評(píng)論
共有 條評(píng)論