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.iflytek.yuyin.MyYuyin;
import com.pojo.Product;
import com.pojo.ProductType;
import com.util.Dbutil;
import com.util.StringUtil;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
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();
}
}
}
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);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(20)
.addComponent(jLabel1)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(s_productNameTxt, GroupLayout.PREFERRED_SIZE, 86, GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(s_productTimeTxt, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addComponent(jLabel3)
.addGap(18)
.addComponent(s_jcbProductType, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
.addComponent(jb_search, GroupLayout.PREFERRED_SI
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
基于java eclipse 开发的具有人脸识别功能和语音识别功能的简易商城系统 (240个子文件)
ProductBuyInterFrm.class 18KB
ProductManageInterFrm.class 16KB
ProductTypeManageInterFrm.class 12KB
ProductAddInterFrm.class 9KB
CustomerAddInterFrm.class 9KB
CustomerLogOnFrm.class 9KB
ManagerLogOnFrm.class 8KB
CustomerAddInterFrm2.class 8KB
ProductTypeInterFrm.class 6KB
MainFrm.class 6KB
FaceMainFrame.class 5KB
FuntionMainFrm.class 4KB
ProductDao.class 4KB
BaiduFaceApi.class 4KB
HttpUtil.class 3KB
ProductChosenDao.class 3KB
FaceMainFrame$3$1.class 3KB
ProductTypeDao.class 3KB
Product.class 2KB
Viewmainfrme.class 2KB
FileUtil.class 2KB
AuthToken.class 2KB
FaceMainFrame$3.class 2KB
Base64Util.class 2KB
Customer.class 2KB
AboutOur.class 2KB
CustomerUserDao.class 2KB
Dbutil.class 2KB
ManagerUserDao.class 1KB
GsonUtils.class 1KB
ProductType.class 1KB
CustomerAddInterFrm$3.class 1KB
CustomerAddInterFrm$4.class 1KB
CustomerAddInterFrm$2.class 1KB
ManagerUser.class 1KB
ProductManageInterFrm$3.class 1010B
ProductManageInterFrm$4.class 1010B
FaceMainFrame$2.class 995B
ProductTypeManageInterFrm$2.class 939B
ProductManageInterFrm$1.class 916B
ProductBuyInterFrm$2.class 898B
ProductBuyInterFrm$4.class 898B
Viewmainfrme$1.class 885B
FuntionMainFrm$4.class 879B
ManagerLogOnFrm$4.class 875B
ProductTypeManageInterFrm$5.class 852B
ProductTypeManageInterFrm$1.class 852B
ProductTypeManageInterFrm$4.class 852B
VoiceTest.class 851B
Viewmainfrme$3.class 833B
Viewmainfrme$2.class 831B
ProductManageInterFrm$7.class 824B
ProductManageInterFrm$5.class 824B
ProductManageInterFrm$6.class 824B
ProductTypeManageInterFrm$3.class 820B
CustomerAddInterFrm2$1.class 817B
MainFrm$1.class 811B
ProductTypeInterFrm$2.class 810B
ProductTypeInterFrm$1.class 810B
CustomerAddInterFrm$1.class 810B
ProductBuyInterFrm$7.class 803B
ProductAddInterFrm$1.class 803B
ProductBuyInterFrm$8.class 803B
ProductAddInterFrm$2.class 803B
ProductBuyInterFrm$1.class 803B
ProductBuyInterFrm$6.class 803B
ProductManageInterFrm$2.class 792B
CustomerLogOnFrm$1.class 789B
CustomerLogOnFrm$2.class 789B
ManagerLogOnFrm$2.class 782B
ManagerLogOnFrm$1.class 782B
ManagerLogOnFrm$3.class 782B
FuntionMainFrm$1.class 775B
FuntionMainFrm$2.class 775B
FuntionMainFrm$3.class 775B
ProductBuyInterFrm$3.class 771B
ProductBuyInterFrm$5.class 771B
FaceMainFrame$1.class 757B
Dbutil$1.class 744B
MainFrm$3.class 726B
MainFrm$2.class 726B
MainFrm$4.class 726B
MainFrm$5.class 726B
MainFrm$6.class 726B
AboutOur$1.class 719B
StringUtil.class 616B
CustomerAddInterFrm2$2.class 577B
CustomerAddInterFrm$5.class 573B
CustomerLogOnFrm$3.class 561B
ManagerLogOnFrm$5.class 557B
FuntionMainFrm$5.class 553B
MainFrm$7.class 525B
.classpath 1KB
urec.data 80B
u.data 12B
msc64.dll 1.44MB
msc32.dll 1.21MB
ProductBuyInterFrm.form 22KB
ProductBuyInterFrm.form 22KB
ProductManageInterFrm.form 20KB
共 240 条
- 1
- 2
- 3
BLEEM666
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- rainy-day.jpg
- IMG_20240501_171218.jpg
- Swift-内购封装swift版本
- 经典CNN网络之ResNet 图像分类网络实战项目:7种小麦叶片病害分类(迁移学习)
- Java毕设之ssm010基于ssm的新能源汽车在线租赁管理系统+vue.rar
- Java毕设之ssm009毕业生就业信息统计系统+vue.rar
- Java毕设之ssm008医院门诊挂号系统+jsp.rar
- Java毕设之ssm007亚盛汽车配件销售业绩管理统+jsp.rar
- Java毕设之ssm006基于java的少儿编程网上报名系统+vue.rar
- Java毕设之ssm005基于SSM框架的购物商城系统+jsp.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0