package com.view;
import com.util.Dbutil;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import com.dao.AuctionDao;
import com.dao.CustomerUserDao;
import com.dao.ProductChosenDao;
import com.dao.ProductDao;
import com.dao.ProductTypeDao;
import com.model.Customer;
import com.model.Product;
import com.model.ProductType;
import com.util.Dbutil;
import com.util.StringUtil;
import javax.swing.JTextField;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.GroupLayout;
import java.awt.Color;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
/**
*商品购买
* @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();
AuctionDao auctionDao = new AuctionDao();
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) {
e.printStackTrace();
} finally {
try {
dbutil.closeCon(con);
} catch (Exception e) {
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) {
e.printStackTrace();
} finally {
try {
dbutil.closeCon(con);
} catch (Exception e) {
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();
}
}
}
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
没有合适的资源?快使用搜索试试~ 我知道了~
1217.swing在线拍卖系统.zip
共127个文件
class:72个
java:25个
png:16个
需积分: 5 0 下载量 80 浏览量
2024-04-26
17:31:31
上传
评论
收藏 3.6MB ZIP 举报
温馨提示
1217.swing在线拍卖系统
资源推荐
资源详情
资源评论
收起资源包目录
1217.swing在线拍卖系统.zip (127个子文件)
ProductBuyInterFrm.class 19KB
ProductManageInterFrm.class 16KB
ProductTypeManageInterFrm.class 12KB
AauctionMainFrm.class 10KB
ProductAddInterFrm.class 9KB
CustomerLogOnFrm.class 9KB
CustomerAddInterFrm.class 7KB
ManagerLogOnFrm.class 7KB
CustomerLogOnInterFrm.class 7KB
ProductTypeInterFrm.class 6KB
MainFrme.class 5KB
ProductDao.class 4KB
FuntionMainFrm.class 4KB
ProductChosenDao.class 3KB
AuctionDao.class 3KB
ProductTypeDao.class 3KB
Product.class 2KB
CustomerUserDao.class 2KB
ManagerUserDao.class 2KB
Auction.class 2KB
Customer.class 2KB
Dbutil.class 2KB
ManagerUser.class 1KB
ProductType.class 1KB
ProductManageInterFrm$3.class 1010B
ProductManageInterFrm$4.class 1010B
CustomerLogOnInterFrm$1.class 1010B
CustomerLogOnFrm$1.class 958B
ProductTypeManageInterFrm$2.class 939B
ProductManageInterFrm$1.class 916B
AauctionMainFrm$5.class 908B
ProductBuyInterFrm$2.class 898B
ProductBuyInterFrm$4.class 898B
ProductTypeManageInterFrm$4.class 852B
ProductTypeManageInterFrm$5.class 852B
ProductTypeManageInterFrm$1.class 852B
AauctionMainFrm$2.class 824B
ProductManageInterFrm$6.class 824B
AauctionMainFrm$6.class 824B
AauctionMainFrm$3.class 824B
CustomerLogOnInterFrm$2.class 824B
AauctionMainFrm$1.class 824B
ProductManageInterFrm$5.class 824B
AauctionMainFrm$4.class 824B
CustomerLogOnInterFrm$3.class 824B
ProductManageInterFrm$7.class 824B
ProductTypeManageInterFrm$3.class 820B
CustomerLogOnFrm$2.class 813B
ProductTypeInterFrm$1.class 810B
CustomerAddInterFrm$1.class 810B
ProductTypeInterFrm$2.class 810B
ProductBuyInterFrm$1.class 803B
ProductBuyInterFrm$7.class 803B
ProductBuyInterFrm$8.class 803B
ProductAddInterFrm$1.class 803B
ProductAddInterFrm$2.class 803B
ProductBuyInterFrm$6.class 803B
ProductManageInterFrm$2.class 792B
ManagerLogOnFrm$2.class 782B
ManagerLogOnFrm$3.class 782B
ManagerLogOnFrm$1.class 782B
FuntionMainFrm$1.class 775B
FuntionMainFrm$2.class 775B
FuntionMainFrm$3.class 775B
ProductBuyInterFrm$5.class 771B
ProductBuyInterFrm$3.class 771B
MainFrme$2.class 733B
MainFrme$3.class 733B
MainFrme$1.class 733B
StringUtil.class 616B
FuntionMainFrm$4.class 553B
MainFrme$4.class 529B
.classpath 435B
product manager.gif 1KB
shopadd.gif 989B
modify.gif 561B
manager.gif 227B
mysql-connector-java-5.0.4-bin.jar 484KB
swing-layout-1.0.3.jar 115KB
AbsoluteLayout.jar 3KB
ProductBuyInterFrm.java 26KB
ProductManageInterFrm.java 21KB
ProductTypeManageInterFrm.java 15KB
AauctionMainFrm.java 11KB
ProductAddInterFrm.java 10KB
CustomerLogOnFrm.java 8KB
CustomerAddInterFrm.java 8KB
CustomerLogOnInterFrm.java 7KB
ProductTypeInterFrm.java 7KB
ManagerLogOnFrm.java 6KB
ProductDao.java 4KB
FuntionMainFrm.java 4KB
MainFrme.java 4KB
AuctionDao.java 2KB
Product.java 2KB
ProductTypeDao.java 2KB
ProductChosenDao.java 2KB
Customer.java 2KB
CustomerUserDao.java 2KB
Auction.java 1KB
共 127 条
- 1
- 2
资源评论
乐韬科技
- 粉丝: 20
- 资源: 107
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 部署yolov8的tensorrt模型支持检测分割姿态估计的C++源码+部署步骤.zip
- 以简单、易用、高性能为目标、开源的时序数据库,支持Linux及Windows, Time Series Database.zip
- python-leetcode面试题解之第198题打家劫舍-题解.zip
- python-leetcode面试题解之第191题位1的个数-题解.zip
- python-leetcode面试题解之第186题反转字符串中的单词II-题解.zip
- 一个基于python的web后端高性能开发框架,下载可用
- python-leetcode面试题解之第179题最大数-题解.zip
- python-leetcode面试题解之第170题两数之和III数据结构设计-题解.zip
- python-leetcode面试题解之第168题Excel表列名称-题解.zip
- python-leetcode面试题解之第167题两数之和II输入有序数组-题解.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功