/*
* ProductBuyInterFrm.java
*
* Created on __DATE__, __TIME__
*/
package com.view;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import com.dao.ProductChosenDao;
import com.dao.ProductDao;
import com.dao.ProductTypeDao;
import com.model.Product;
import com.model.ProductType;
import com.util.Dbutil;
import com.util.StringUtil;
/**
*
* @author __USER__
*/
public class ProductBuyInterFrm extends javax.swing.JInternalFrame {
Dbutil dbutil = new Dbutil();
ProductDao productDao = new ProductDao();
ProductTypeDao productTypeDao = new ProductTypeDao();
ProductChosenDao productChosenDao = new ProductChosenDao();
/** Creates new form ProductBuyInterFrm */
public ProductBuyInterFrm() {
initComponents();
this.setLocation(200, 20);
this.fillTable(new Product());
this.fillChosenTable();
this.fillProductType("search");
this.fillProductType("putInto");
}
private void fillProductType(String type) {
Connection con = null;
ProductType productType = null;
try {
con = dbutil.getCon();
ResultSet rs = productTypeDao.productTypeList(con,
new ProductType());
if ("search".equals(type)) {
productType = new ProductType();
productType.setProductTypeName("请选择....");
productType.setId(-1);
this.s_jcbProductType.addItem(productType);
}
while (rs.next()) {
productType = new ProductType();
productType.setId(rs.getInt("id"));
productType.setProductTypeName(rs.getString("productTypeName"));
if ("search".equals(type)) {
this.s_jcbProductType.addItem(productType);
} else if ("putInto".equals(type)) {
this.jcb_productType.addItem(productType);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
dbutil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private void fillTable(Product product) {
DefaultTableModel dtm = (DefaultTableModel) productTable.getModel();
dtm.setRowCount(0);//要把前面的数据释放掉
Connection con = null;
try {
con = dbutil.getCon();
ResultSet rs = productDao.productList(con, product);
while (rs.next()) {
Vector v = new Vector();
v.add(rs.getInt("id"));
v.add(rs.getString("productName"));
v.add(rs.getString("productTime"));
v.add(rs.getFloat("price"));
v.add(rs.getString("productDesc"));
v.add(rs.getString("productTypeName"));
dtm.addRow(v);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
dbutil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private void fillChosenTable() {
DefaultTableModel dtm = (DefaultTableModel) ProductChosenTable
.getModel();
dtm.setRowCount(0);//要把前面的数据释放掉
Connection con = null;
try {
con = dbutil.getCon();
ResultSet rs = productDao.productChosenList(con);
while (rs.next()) {
Vector v = new Vector();
v.add(rs.getInt("id"));
v.add(rs.getString("productName"));
v.add(rs.getString("productTime"));
v.add(rs.getFloat("price"));
v.add(rs.getString("productDesc"));
v.add(rs.getString("productTypeName"));
dtm.addRow(v);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
dbutil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jDialog1 = new javax.swing.JDialog();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
s_productNameTxt = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
s_productTimeTxt = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
s_jcbProductType = new javax.swing.JComboBox();
jb_search = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
productTable = new javax.swing.JTable();
jPanel2 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
ProductChosenTable = new javax.swing.JTable();
jb_delete = new javax.swing.JButton();
jb_cost = new javax.swing.JButton();
jb_putProductIntoCar = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
productDescTxt = new javax.swing.JTextArea();
jLabel9 = new javax.swing.JLabel();
jcb_productType = new javax.swing.JComboBox();
jLabel8 = new javax.swing.JLabel();
productTimeTxt = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
priceTxt = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
productNameTxt = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
idTxt = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
setClosable(true);
setIconifiable(true);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("\u6311\u9009\u5546\u54c1"));
jLabel1.setText("\u5546\u54c1\u540d\u79f0");
jLabel2.setText("\u751f\u4ea7\u65e5\u671f");
jLabel3.setText("\u5546\u54c1\u7c7b\u522b");
jb_search.setIcon(new javax.swing.ImageIcon("./images\\search.png")); // NOI18N
jb_search.setText("\u67e5\u8be2");
jb_search.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jb_searchActionPerformed(evt);
}
});
productTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"编号", "商品名称", "生产日期", "商品价格", "商品描述", "商品类别"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
productTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
productTableMousePressed(evt);
}
});
jScrollPane1.setViewportView(productTable);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(s_productNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(s_productTimeTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(s_jcbProductType, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 166, Short.MAX_VALUE)
.addComponent(jb_search)
.addGap(38, 38, 38))
.addComponent(jScrollPa
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
一、项目简介 本项目是一套java Swing mysql实现简单的购物系统,主要针对计算机相关专业需要项目实战练习的Java学习者。 包含:项目源码、数据库脚本、运行指导视频。 项目都经过严格调试,确保可以运行! 二、技术实现 后端:java swing,面向对象 开发工具:eclipse、Navicat 三、系统划分与功能 管理员登录 商品种类管理:商品类别添加,商品类别维护 商品管理:商品添加、修改、删除、查看 商品管理:商品添加、修改、删除、查看 浏览商品,添加到购物车 新会员注册
资源推荐
资源详情
资源评论
收起资源包目录
java Swing mysql实现简单的购物系统【源码+数据库+运行指导视频】 (146个子文件)
运行视频.avi 83.21MB
ProductBuyInterFrm.class 18KB
ProductManageInterFrm.class 16KB
ProductTypeManageInterFrm.class 12KB
ProductAddInterFrm.class 9KB
CustomerLogOnFrm.class 8KB
ManagerLogOnFrm.class 8KB
CustomerAddInterFrm.class 7KB
CustomerLogOnInterFrm.class 7KB
ProductTypeInterFrm.class 6KB
MainFrm.class 6KB
ViewMainFrm.class 5KB
ProductDao.class 4KB
FuntionMainFrm.class 4KB
ProductChosenDao.class 3KB
ProductTypeDao.class 3KB
Product.class 2KB
Customer.class 2KB
CustomerUserDao.class 2KB
Dbutil.class 2KB
ManagerUserDao.class 1KB
ProductType.class 1KB
ManagerUser.class 1KB
ProductManageInterFrm$3.class 1014B
ProductManageInterFrm$4.class 1014B
CustomerLogOnInterFrm$1.class 1014B
ProductTypeManageInterFrm$2.class 939B
ProductManageInterFrm$1.class 916B
ProductBuyInterFrm$2.class 898B
ProductBuyInterFrm$4.class 898B
ProductTypeManageInterFrm$1.class 856B
ProductTypeManageInterFrm$5.class 856B
ProductTypeManageInterFrm$4.class 856B
ProductManageInterFrm$7.class 828B
CustomerLogOnInterFrm$2.class 828B
CustomerLogOnInterFrm$3.class 828B
ProductManageInterFrm$6.class 828B
ProductManageInterFrm$5.class 828B
ProductTypeManageInterFrm$3.class 824B
ProductTypeInterFrm$2.class 814B
ProductTypeInterFrm$1.class 814B
CustomerAddInterFrm$1.class 814B
ProductBuyInterFrm$7.class 807B
ProductAddInterFrm$1.class 807B
ProductAddInterFrm$2.class 807B
ProductBuyInterFrm$6.class 807B
ProductBuyInterFrm$8.class 807B
ProductBuyInterFrm$1.class 807B
ProductManageInterFrm$2.class 796B
CustomerLogOnFrm$2.class 793B
CustomerLogOnFrm$1.class 793B
ManagerLogOnFrm$3.class 786B
ManagerLogOnFrm$1.class 786B
ManagerLogOnFrm$2.class 786B
FuntionMainFrm$2.class 779B
FuntionMainFrm$1.class 779B
FuntionMainFrm$3.class 779B
ProductBuyInterFrm$3.class 775B
ProductBuyInterFrm$5.class 775B
ViewMainFrm$3.class 758B
ViewMainFrm$1.class 758B
ViewMainFrm$2.class 758B
MainFrm$3.class 730B
MainFrm$2.class 730B
MainFrm$4.class 730B
MainFrm$1.class 730B
MainFrm$5.class 730B
StringUtil.class 616B
CustomerLogOnFrm$3.class 565B
ManagerLogOnFrm$4.class 561B
FuntionMainFrm$4.class 557B
ViewMainFrm$4.class 545B
MainFrm$6.class 529B
.classpath 427B
ProductBuyInterFrm.form 22KB
ProductBuyInterFrm.form 22KB
ProductManageInterFrm.form 20KB
ProductManageInterFrm.form 20KB
ProductTypeManageInterFrm.form 12KB
ProductTypeManageInterFrm.form 12KB
ProductAddInterFrm.form 10KB
ProductAddInterFrm.form 10KB
MainFrm.form 9KB
MainFrm.form 9KB
ManagerLogOnFrm.form 8KB
ManagerLogOnFrm.form 8KB
CustomerLogOnFrm.form 7KB
CustomerLogOnFrm.form 7KB
ProductTypeInterFrm.form 7KB
ProductTypeInterFrm.form 7KB
CustomerAddInterFrm.form 6KB
CustomerAddInterFrm.form 6KB
ViewMainFrm.form 4KB
ViewMainFrm.form 4KB
FuntionMainFrm.form 4KB
FuntionMainFrm.form 4KB
product manager.gif 1KB
shopadd.gif 989B
modify.gif 561B
manager.gif 227B
共 146 条
- 1
- 2
飞翔的佩奇
- 粉丝: 3643
- 资源: 811
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页