网上书店完整代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
附录全部源代码
package class Connect {
private static Connection con = null;
private static String url="jdbc:oracle:thin:@localhost:1521:ORCL";
private static String driver = "";
private static String user = "scott";
private static String pwd = "tiger";
public static Connection getConnection(){
try {
(driver);
con = (url, user, pwd);
"数据库连接成功!");
} catch (ClassNotFoundException e) {
"驱动加载失败!");;
} catch (SQLException e) {
"数据库连接失败!");
}
return con;
}
public static void main(String[] args) {
();
}
}
package class docMenuAction implements ActionListener { RegisterFrame register = null;
JPanel cusPanel = null;
JPanel docPanel = null;
public docMenuAction(RegisterFrame register){
= register;
= ;
= ;
}
public void actionPerformed(ActionEvent e) {
于用户搜索商品
public ArrayList getAllSellerGoods(){
ArrayList list = new ArrayList();
conn = ();
try {
statement = ();
String sql = "select * from goods a,seller b where =";
resultSet = (sql);
while()){
Seller seller = new Seller();
("seller_name"));
("address"));
Goods goods = new Goods();
(seller);
("goods_id"));
("goods_name"));
("seller_id"));
("discount"));
("num"));
("price"));
2012-9-192012-9-192012-9-192012-9-19etImage());
(null);
(null);
(false);
etImage());
(600, 400);
;
(null);
(menuBar,;
setGoodsPanel();
;
(goodsPanel,;
;
setSouthPanel();
setOrderPanel();
(southPanel,;
}
quals())){
(null, "请输入商品编号或商品数量!");
}else{
int id = ());
int num = ((String) ());
goods = (id);
if(null, "您确定要购买吗")==0){
if()==0){
(null, "商品编号输入错误!");
}else{
if() (null, "商品数量不足!"); }else{ ()-num); (goods); OrderDao order = new OrderDao(); (goods, num); (null, "购买成功!"); setAr(); setOr(); (); } } }else{ } } } }); } etName(); ar[i][7]=().getAddress(); } } private void setArNull(){ for(int i=0;i<;i++){ for(int j=0;j ar[i][j]=""; } } } etName(); or[i][3]=().getPrice(); or[i][4]=().getDiscount(); or[i][5]=().getPrice()*().getDiscount()*; or[i][6]=(); or[i][7]=().getName(); or[i][8]=().getAddress(); } } private void setOrNull(){ for(int i=0;i<;i++){ for(int j=0;j or[i][j]=""; } } } public static void main(String[] args) { BuyerFrame frame = new BuyerFrame(); (true); } } package class LoginFrame extends JFrame{ private JLabel userNameLabel = new JLabel("用户名:"); private JLabel pwdLabel = new JLabel("密码:"); private JTextField useNameText = new JTextField();