/*
* 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从业经验,精通JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA职业规划、技术提升的可与我联系,交个朋友~ 本人十余年JAVA从业经验,精通JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA职业规划、技术提升的可与我联系,交个朋友~ 本人十余年JAVA从业经验,精通JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA职业规划、技术提升的可与我联系,交个朋友~
资源推荐
资源详情
资源评论
收起资源包目录
《JAVA课程设计》--java课程设计 基于MySQL的GUI界面的二手交易平台.zip (187个子文件)
ProductBuyInterFrm.class 18KB
ProductManageInterFrm.class 16KB
ProductTypeManageInterFrm.class 12KB
ProductAddInterFrm.class 9KB
CustomerLogOnFrm.class 8KB
ManagerLogOnFrm.class 8KB
CustomerAddInterFrm.class 7KB
CustomerLogOnInterFrm.class 7KB
client.class 7KB
server.class 7KB
ProductTypeInterFrm.class 6KB
MainFrm.class 6KB
ViewMainFrm.class 5KB
FuntionMainFrm.class 4KB
ProductDao.class 4KB
ClientThread.class 3KB
addeva.class 3KB
ProductChosenDao.class 3KB
ServerThread.class 3KB
alleva.class 3KB
ProductTypeDao.class 3KB
addeva$2.class 2KB
Product.class 2KB
ClinetRecive.class 2KB
Customer.class 2KB
CustomerUserDao.class 2KB
server$5.class 2KB
server$4.class 2KB
Dbutil.class 2KB
ManagerUserDao.class 1KB
server$2.class 1KB
client$3.class 1KB
ProductType.class 1KB
client$2.class 1KB
server$1.class 1KB
client$1.class 1KB
client$5.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
evaluation.class 892B
ProductTypeManageInterFrm$4.class 856B
ProductTypeManageInterFrm$1.class 856B
ProductTypeManageInterFrm$5.class 856B
ProductManageInterFrm$6.class 828B
CustomerLogOnInterFrm$2.class 828B
ProductManageInterFrm$5.class 828B
CustomerLogOnInterFrm$3.class 828B
ProductManageInterFrm$7.class 828B
ProductTypeManageInterFrm$3.class 824B
FuntionMainFrm$4.class 822B
client$4.class 819B
ProductTypeInterFrm$1.class 814B
CustomerAddInterFrm$1.class 814B
ProductTypeInterFrm$2.class 814B
ProductBuyInterFrm$1.class 807B
ProductBuyInterFrm$7.class 807B
ProductBuyInterFrm$8.class 807B
ProductAddInterFrm$1.class 807B
ProductAddInterFrm$2.class 807B
ProductBuyInterFrm$6.class 807B
ProductManageInterFrm$2.class 796B
CustomerLogOnFrm$2.class 793B
CustomerLogOnFrm$1.class 793B
MainFrm$5.class 792B
ManagerLogOnFrm$2.class 786B
ManagerLogOnFrm$1.class 786B
ManagerLogOnFrm$3.class 786B
FuntionMainFrm$1.class 779B
FuntionMainFrm$2.class 779B
FuntionMainFrm$3.class 779B
ProductBuyInterFrm$5.class 775B
ProductBuyInterFrm$3.class 775B
ViewMainFrm$2.class 758B
ViewMainFrm$1.class 758B
MainFrm$3.class 730B
MainFrm$4.class 730B
MainFrm$1.class 730B
MainFrm$2.class 730B
MainFrm$7.class 730B
server$3.class 727B
FuntionMainFrm$5.class 714B
alleva$1.class 713B
addeva$1.class 713B
MainFrm$6.class 672B
StringUtil.class 616B
CustomerLogOnFrm$3.class 565B
ManagerLogOnFrm$4.class 561B
FuntionMainFrm$6.class 557B
ViewMainFrm$3.class 545B
MainFrm$8.class 529B
.classpath 614B
ProductBuyInterFrm.form 22KB
ProductBuyInterFrm.form 22KB
ProductManageInterFrm.form 20KB
共 187 条
- 1
- 2
资源评论
季风泯灭的季节
- 粉丝: 599
- 资源: 2921
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功