diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java index 78ff81d..7dd37eb 100644 --- a/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java +++ b/Supermarket/src/com/lingnan/supermarket/dialog/InDialog.java @@ -1,5 +1,7 @@ +// 定义包名,表明该类属于com.lingnan.supermarket.dialog包 package com.lingnan.supermarket.dialog; +// 导入所需的java.awt、java.awt.event、javax.swing包中的类 import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; @@ -18,6 +20,7 @@ import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.JTextField; +// 导入com.lingnan.supermarket包及其子包中的类 import com.lingnan.supermarket.*; import com.lingnan.supermarket.dao.UserService; import com.lingnan.supermarket.dao.impl.BufferImpl; @@ -31,195 +34,377 @@ import com.lingnan.supermarket.view.InView; import com.lingnan.supermarket.view.OutView; import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; - +// 定义InDialog类,继承JDialog并实现ActionListener接口 public class InDialog extends JDialog implements ActionListener{ - - + + // 声明面板变量 private JPanel prodIdPanel,sumPanel,phonePanel,opePanel; - + + // 声明标签变量 private JLabel prodIdLabel,sumLabel; + // 声明文本框变量 private JTextField prodIdTF,sumTF; - + + // 声明按钮变量 private JButton addBtn,cancelBtn; - - + + + // 实例化OutTableModel对象 private OutTableModel outTableModel = new OutTableModel(); - + + // 声明Production对象 private Production production; + // 声明productionImpl对象 private productionImpl productionImpl; - + + // 声明Vector对象 private Vector v; - + + // 声明User对象 private User user; - + + // 声明JFrame对象 private JFrame JFramparent; - + + // 声明JComboBox对象 private JComboBox combo; + // 声明字符串数组 private String allProdId[] = null; + // 声明Vector对象 private Vector vAll; + // 声明静态字符串变量 private static String catalog; - + + // 构造方法,接收JFrame、Vector和User对象作为参数 public InDialog(JFrame parent,Vector v,User user) { super(parent,"添加商品"); - - setSize(250,200); - setLocationRelativeTo(null); + + // 设置对话框大小 + setSize(250,200); + // 设置对话框相对于父窗口居中 + setLocationRelativeTo(null); + // 设置对话框为模态 setModal(true); - setResizable(false); + // 设置对话框不可调整大小 + setResizable(false); + // 设置对话框布局为FlowLayout this.setLayout(new FlowLayout()); + // 初始化父窗口引用 JFramparent=parent; + // 初始化Vector引用 this.v=v; + // 初始化User引用 this.user = user; + // 初始化视图 initView(); - - + + + + } - - - - - + + + + + + + // 初始化视图的私有方法 private void initView() { + // 创建编号面板 prodIdPanel = new JPanel(); + // 创建编号标签 prodIdLabel = new JLabel("编号"); - + + // 实例化productionImpl对象 productionImpl= new productionImpl(); + // 获取所有产品的列表 vAll=productionImpl.findAllproduction(); + // 初始化字符串数组,长度与产品列表相同 allProdId = new String[vAll.size()]; + // 遍历产品列表,将产品编号存入数组 for(int i=0;i(allProdId); + // 为下拉列表添加ItemListener监听器 combo.addItemListener(new MyItemListener()); - + + // 将编号标签和下拉列表添加到编号面板 prodIdPanel.add(prodIdLabel); prodIdPanel.add(combo); - - - + + + + // 创建数量面板 sumPanel = new JPanel(); + // 创建数量标签 sumLabel = new JLabel("数量"); + // 创建数量文本框 sumTF = new JTextField(10); + // 将数量标签和文本框添加到数量面板 sumPanel.add(sumLabel); sumPanel.add(sumTF); - - + + + // 创建操作按钮面板 opePanel = new JPanel(); + // 创建添加按钮 addBtn = new JButton("添加"); + // 创建取消按钮 cancelBtn = new JButton("取消"); + // 为添加按钮添加ActionListener监听器 addBtn.addActionListener(this); + // 为取消按钮添加ActionListener监听器 cancelBtn.addActionListener(this); + // 将添加和取消按钮添加到操作按钮面板 opePanel.add(addBtn); opePanel.add(cancelBtn); - + + // 获取内容面板 Container container = getContentPane(); + // 将所有面板添加到内容面板 container.add(prodIdPanel); container.add(sumPanel); container.add(opePanel); } - - /*将数组传到inview的刷新方法里面再刷新*/ + + // 提供一个方法来获取Vector对象 public Vector getVector(){ + // 返回v对象 return v; } - - - //下拉框监听 + + + // 实现ItemListener接口的静态内部类,用于监听下拉列表的事件 static class MyItemListener implements ItemListener{ @Override + // 当下拉列表的选项状态改变时触发此方法 public void itemStateChanged(ItemEvent e) { + // 将事件源转换为JComboBox JComboBox cb=(JComboBox)e.getSource(); + // 获取选中的选项 String select=(String) cb.getSelectedItem(); + // 更新目录为选中的选项 catalog=select; } - + } - - - - - - - + + + + + + + + @Override +// 实现ActionListener接口的actionPerformed方法,用于处理按钮点击事件 public void actionPerformed(ActionEvent e) { + // 获取事件源对象 Object source = e.getSource(); + // 如果事件源是添加按钮 if(source==addBtn){ - //1.判断是否存在这个商品 - //2.如果存在就获取这条商品记录为一个对象 - //3.判断购物缓冲区是否有这个记录 - //3.1如果有update数量和price - //3.2如果没有就insert这条记录,把sum更新 - //保存到数据库 - //关闭对话框 - //刷新table - + // 1.判断是否存在这个商品 + // 2.如果存在就获取这条商品记录为一个对象 + // 3.判断购物缓冲区是否有这个记录 + // 3.1如果有update数量和price + // 3.2如果没有就insert这条记录,把sum更新 + // 保存到数据库 + // 关闭对话框 + // 刷新table + + // 获取当前选中的商品编号 String prodId =catalog; + // 打印商品编号 System.out.println("proId="+prodId); + // 打印当前目录(应该是商品编号) System.out.println("vatalog="+catalog); - + + // 判断数量文本框是否为空 if(sumTF.getText().equals("")) { + // 显示错误提示信息 JOptionPane.showMessageDialog(this,"请输入完整","提示",JOptionPane.ERROR_MESSAGE); return; } + // 将文本框中的字符串转换为整数 int sum = Integer.parseInt(sumTF.getText()) ; - if(sum<0) {/*判断输入大于0*/ + // 判断输入的数量是否大于0 + if(sum<0) { + // 显示错误提示信息 JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE); return; } - - //TODO 参数校验 - /*/判断是已添加,未添加还是不存在*/ + + // TODO 参数校验 + // 判断商品是已添加、未添加还是不存在 productionImpl productionImpl = new productionImpl(); production = new Production(); + // 根据商品编号查找商品 production = productionImpl.findByIdProduction(prodId); - if(production!=null) {/*商品库有这个商品存在*/ + // 如果商品库中有这个商品存在 + if(production!=null) { + // 标记变量,用于判断是否在购物缓冲区找到相同商品 int mark = 0; + // 遍历购物缓冲区 for(Production p:v) { - - if(p.getId().equals(prodId)){/*如果数组中存在相同商品就更新数量和价格*/ - sum=p.getSum()+sum;/*数量*/ + + // 如果找到相同商品编号 + if(p.getId().equals(prodId)){ + // 更新数量 + sum=p.getSum()+sum; p.setSum(sum); - p.setPrice(sum*p.getInPrice());/*进货价格*/ + // 更新价格 + p.setPrice(sum*p.getInPrice()); + // 设置标记为找到 mark = 1; break; } - + } - if(mark==0) {/*插入新的*/ + // 如果购物缓冲区中没有找到相同商品 + if(mark==0) { + // 打印信息 System.out.println("缓存区不存在,插入新的数据"); - production.setSum(sum);/*更新价格和数量后插入心的*/ + // 更新商品的数量和价格 + production.setSum(sum); production.setPrice(sum*production.getInPrice()); + // 将商品添加到购物缓冲区 v.add(production); - } - + } + + // 打印购物缓冲区的大小 System.out.println("插入后v的大小"+v.size()); + // 关闭对话框 this.dispose(); + // 显示添加成功的提示信息 JOptionPane.showMessageDialog(this,"添加成功","提示",JOptionPane.ERROR_MESSAGE); - - - } - - else {/*商品库没有这个商品*/ - JOptionPane.showMessageDialog(this,"商品不存在","提示",JOptionPane.ERROR_MESSAGE); - } - } - else if(source == cancelBtn) { - - this.dispose(); - } + + } + + + // 如果商品库中没有这个商品 + else {/*商品库没有这个商品*/ + // 显示商品不存在的错误提示信息 + JOptionPane.showMessageDialog(this,"商品不存在","提示",JOptionPane.ERROR_MESSAGE); + } + + // 如果事件源是取消按钮 + else if(source == cancelBtn) { + // 关闭当前对话框 + this.dispose(); + + + } + + } } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java index 9016fb9..a2dbac8 100644 --- a/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java +++ b/Supermarket/src/com/lingnan/supermarket/dialog/ProductionDialog.java @@ -1,5 +1,7 @@ +// 定义包名,表明该类属于com.lingnan.supermarket.dialog包 package com.lingnan.supermarket.dialog; +// 导入所需的java.awt和javax.swing包中的类 import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; @@ -17,6 +19,7 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; +// 导入com.lingnan.supermarket包中的相关类 import com.lingnan.supermarket.*; import com.lingnan.supermarket.dao.SupplierInfService; import com.lingnan.supermarket.dao.productionService; @@ -31,24 +34,31 @@ import com.lingnan.supermarket.view.StorageView; import com.lingnan.supermarket.view.SupplierView; import com.lingnan.supermarket.view.ProdCatalogView.MyItemListener; +// 定义ProductionDialog类,继承JDialog并实现ActionListener接口 public class ProductionDialog extends JDialog implements ActionListener { + // 声明多个JPanel对象,用于布局 private JPanel namePanel, addressPanel, contactPanel, - opePanel,idPanel,inpricePanel,outpricePanel,lifePanel, - sumPanel,supplyidPanel,id2Panel,name2Panel; + opePanel,idPanel,inpricePanel,outpricePanel,lifePanel, + sumPanel,supplyidPanel,id2Panel,name2Panel; + // 声明多个JLabel对象,用于显示文本 private JLabel nameLabel, addressLabel, contactLabel, - idLabel,inpriceLabel,outpriceLabel,lifeLabel,sumLabel, - supplyidLabel,id2Label,name2Label; + idLabel,inpriceLabel,outpriceLabel,lifeLabel,sumLabel, + supplyidLabel,id2Label,name2Label; + + // 声明多个JTextField对象,用于文本输入 private JTextField nameTF, addressTF, contactTF, - idTF,inpriceTF,outpriceTF,lifeTF,sumTF, - supplyidTF,id2TF,name2TF; + idTF,inpriceTF,outpriceTF,lifeTF,sumTF, + supplyidTF,id2TF,name2TF; + // 声明按钮对象,用于保存和取消操作 private JButton saveBtn, cancelBtn; + // 实例化productionService对象,用于操作产品数据 private productionService productionService = new productionImpl(); - - //下拉类别 + + // 下拉类别相关变量 private String log[]=null; private ArrayListalog=null; private ProdCatalogTM prodCatalogTM; @@ -57,8 +67,8 @@ public class ProductionDialog extends JDialog implements ActionListener { private JComboBox combo; private String id2; private String name2; - - //下拉供应商类别 + + // 下拉供应商类别相关变量 private String superlier[]=null; private ArrayListasuperlier=null; private SupplierInf si; @@ -66,135 +76,199 @@ public class ProductionDialog extends JDialog implements ActionListener { private JComboBox combo1; private int supplyid; + // StorageView对象,用于界面更新 private StorageView storageView; + + // 声明Production对象,用于存储产品信息 private Production production; + // 构造方法,接收一个JFrame对象作为父窗口,并设置对话框标题为"添加" public ProductionDialog(JFrame parent) { super(parent, "添加"); - + // 设置对话框的大小为350x500像素 setSize(350, 500); + // 设置对话框相对于屏幕居中 setLocationRelativeTo(null); + // 设置对话框为模态,即不关闭此对话框无法操作其他窗口 setModal(true); + // 设置对话框不可调整大小 setResizable(false); + // 设置对话框的布局管理器为FlowLayout this.setLayout(new FlowLayout()); + // 初始化视图 initView(); } + // 初始化视图的方法 private void initView() { + // 创建商品编号输入面板 idPanel = new JPanel(); + // 创建商品编号标签 idLabel = new JLabel("商品编号"); + // 创建商品编号文本框 idTF = new JTextField(15); + // 将标签和文本框添加到商品编号输入面板 idPanel.add(idLabel); idPanel.add(idTF); - + // 创建名称输入面板 namePanel = new JPanel(); + // 创建名称标签 nameLabel = new JLabel("名称"); + // 创建名称文本框 nameTF = new JTextField(15); + // 将标签和文本框添加到名称输入面板 namePanel.add(nameLabel); namePanel.add(nameTF); - - + + // 创建进货单价输入面板 inpricePanel = new JPanel(); + // 创建进货单价标签 inpriceLabel = new JLabel("进货单价"); + // 创建进货单价文本框 inpriceTF = new JTextField(15); + // 将标签和文本框添加到进货单价输入面板 inpricePanel.add(inpriceLabel); inpricePanel.add(inpriceTF); - + + // 创建购买单价输入面板 outpricePanel = new JPanel(); + // 创建购买单价标签 outpriceLabel = new JLabel("购买单价"); + // 创建购买单价文本框 outpriceTF = new JTextField(15); + // 将标签和文本框添加到购买单价输入面板 outpricePanel.add(outpriceLabel); outpricePanel.add(outpriceTF); - - + + // 创建保质期输入面板 lifePanel = new JPanel(); + // 创建保质期标签 lifeLabel = new JLabel("保质期(月份数)"); + // 创建保质期文本框 lifeTF = new JTextField(15); + // 将标签和文本框添加到保质期输入面板 lifePanel.add(lifeLabel); lifePanel.add(lifeTF); - - + + // 创建库存输入面板 sumPanel = new JPanel(); + // 创建库存标签 sumLabel = new JLabel("库存"); + // 创建库存文本框 sumTF = new JTextField(15); + // 将标签和文本框添加到库存输入面板 sumPanel.add(sumLabel); sumPanel.add(sumTF); - - //供应商名下拉框 传递supplyid + + // 创建供应商选择面板 supplyidPanel = new JPanel(); + // 创建供应商标签 supplyidLabel = new JLabel("供应商"); -// supplyidTF = new JTextField(15); - + // 注释掉的代码,原本可能用于创建供应商文本框,但现在使用下拉框 +// supplyidTF = new JTextField(15); + + + // 实例化SupplierInfImpl对象,用于操作供应商信息 sii=new SupplierInfImpl(); +// 调用findNameSupplier方法获取所有供应商的名称,并存储到asuperlier列表中 this.asuperlier=sii.findNameSupplier(); +// 根据asuperlier列表的大小创建superlier字符串数组 this.superlier=new String[asuperlier.size()]; +// 将asuperlier列表中的元素复制到superlier数组中 for(int i=0;i(superlier); +// 为combo1添加一个ItemListener,用于监听下拉列表选项的变化 combo1.addItemListener(new MyItemListener1()); - + +// 将供应商标签和下拉列表添加到supplyidPanel面板中 supplyidPanel.add(supplyidLabel); supplyidPanel.add(combo1); - - - - - - /* id2Panel = new JPanel(); - id2Label = new JLabel("分类id"); - id2TF = new JTextField(id2,15); - id2Panel.add(id2Label); - id2Panel.add(id2TF);*/ - //类名下拉框 + + + +// 注释掉的代码,原本可能用于创建分类id的输入面板 +/* id2Panel = new JPanel(); + id2Label = new JLabel("分类id"); + id2TF = new JTextField(id2,15); + id2Panel.add(id2Label); + id2Panel.add(id2TF);*/ +// 创建类名输入面板 name2Panel = new JPanel(); +// 创建类名标签 name2Label = new JLabel("类名"); +// 实例化prodCatalogImpl对象,用于操作产品目录信息 pci=new prodCatalogImpl(); +// 调用findNameProdCatalog方法获取所有产品目录的名称,并存储到alog列表中 this.alog=pci.findNameProdCatalog(); +// 根据alog列表的大小创建log字符串数组 this.log=new String[alog.size()]; +// 将alog列表中的元素复制到log数组中 for(int i=0;i(log); +// 为combo添加一个ItemListener,用于监听下拉列表选项的变化 combo.addItemListener(new MyItemListener()); +// 将类名标签和下拉列表添加到name2Panel面板中 name2Panel.add(name2Label); name2Panel.add(combo); - +// 创建地址输入面板 addressPanel = new JPanel(); +// 创建地址标签 addressLabel = new JLabel("地址"); +// 创建地址文本框 addressTF = new JTextField(15); +// 将标签和文本框添加到地址输入面板 addressPanel.add(addressLabel); addressPanel.add(addressTF); +// 创建电话输入面板 contactPanel = new JPanel(); +// 创建电话标签 contactLabel = new JLabel("电话"); +// 创建电话文本框 contactTF = new JTextField(15); +// 将标签和文本框添加到电话输入面板 contactPanel.add(contactLabel); contactPanel.add(contactTF); +// 创建操作按钮面板 opePanel = new JPanel(); +// 创建保存按钮 saveBtn = new JButton("保存"); +// 创建取消按钮 cancelBtn = new JButton("取消"); +// 为保存按钮添加ActionListener,监听按钮点击事件 saveBtn.addActionListener(this); +// 为取消按钮添加ActionListener,监听按钮点击事件 cancelBtn.addActionListener(this); +// 将保存和取消按钮添加到操作按钮面板 opePanel.add(saveBtn); opePanel.add(cancelBtn); +// 获取内容面板 Container container = getContentPane(); +// 将所有面板添加到内容面板中 container.add(idPanel); container.add(namePanel); container.add(inpricePanel); @@ -202,72 +276,97 @@ public class ProductionDialog extends JDialog implements ActionListener { container.add(lifePanel); container.add(sumPanel); container.add(supplyidPanel); -// container.add(id2Panel); +// 注释掉的代码,可能原本用于添加另一个面板 +//container.add(id2Panel); container.add(name2Panel); container.add(opePanel); - } - @Override - public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - if (source == saveBtn) { - // 思路获取数据 - // 保存到数据库 - // 关闭对话框 - // 刷新table - - String name = nameTF.getText(); - String id = idTF.getText(); - float inprice = Float.parseFloat((inpriceTF.getText())); - float outprice = Float.parseFloat(outpriceTF.getText()); - int life = Integer.parseInt(lifeTF.getText()); - int sum = Integer.parseInt(sumTF.getText()); - - - - // TODO 参数校验 - if (this.production == null) { - if(supplyid==-1){ - JOptionPane.showMessageDialog(this, "商品检索出错", "提示", - JOptionPane.ERROR_MESSAGE); - return; - } - if(supplyid==0){ - JOptionPane.showMessageDialog(this, "请选择商品名", "提示", - JOptionPane.ERROR_MESSAGE); - return; - } - if(id2.equals("0")){ - JOptionPane.showMessageDialog(this, "请选择商品类", "提示", - JOptionPane.ERROR_MESSAGE); - return; - } - - Production production = new Production(); - production.setId(id); - production.setName(name); - production.setInPrice(inprice); - production.setOutPrice(outprice); - production.setLife(life); - production.setSum(sum); - production.setSupplyId(supplyid); - production.setId2(id2); - production.setName2(name2); - int result = productionService.addProduction(production); - // int result = 1; - if (result == 1) { - - JOptionPane.showMessageDialog(this, "添加成功", "提示", - JOptionPane.INFORMATION_MESSAGE); - this.dispose(); - } else if(result == 2){ - JOptionPane.showMessageDialog(this, "已存在该商品", "提示", - JOptionPane.ERROR_MESSAGE); - } - else { - JOptionPane.showMessageDialog(this, "出错!添加失败", "提示", - JOptionPane.ERROR_MESSAGE); - } +// 重写actionPerformed方法,以处理按钮点击事件 + @Override + public void actionPerformed(ActionEvent e) { + // 获取事件源 + Object source = e.getSource(); + // 如果事件源是保存按钮 + if (source == saveBtn) { + // 获取文本框中的数据 + String name = nameTF.getText(); + String id = idTF.getText(); + // 将文本框中的字符串转换为浮点数 + float inprice = Float.parseFloat((inpriceTF.getText())); + // 将文本框中的字符串转换为浮点数 + float outprice = Float.parseFloat(outpriceTF.getText()); + // 将文本框中的字符串转换为整数 + int life = Integer.parseInt(lifeTF.getText()); + // 将文本框中的字符串转换为整数 + int sum = Integer.parseInt(sumTF.getText()); + + + + // TODO 参数校验 + // 如果production对象为null,表示是添加新商品 + if (this.production == null) { + // 如果supplyid为-1,表示商品检索出错 + if(supplyid==-1){ + JOptionPane.showMessageDialog(this, "商品检索出错", "提示", + JOptionPane.ERROR_MESSAGE); + return; // 退出方法 + } + // 如果supplyid为0,表示用户没有选择商品名 + if(supplyid==0){ + JOptionPane.showMessageDialog(this, "请选择商品名", "提示", + JOptionPane.ERROR_MESSAGE); + return; // 退出方法 + } + // 如果id2为"0",表示用户没有选择商品类 + if(id2.equals("0")){ + JOptionPane.showMessageDialog(this, "请选择商品类", "提示", + JOptionPane.ERROR_MESSAGE); + return; // 退出方法 + } + + // 创建一个新的Production对象 + Production production = new Production(); + // 设置商品ID + production.setId(id); + // 设置商品名称 + production.setName(name); + // 设置商品进价 + production.setInPrice(inprice); + // 设置商品售价 + production.setOutPrice(outprice); + // 设置商品保质期 + production.setLife(life); + // 设置商品库存 + production.setSum(sum); + // 设置供应商ID + production.setSupplyId(supplyid); + // 设置商品类别ID + production.setId2(id2); + // 设置商品类别名称 + production.setName2(name2); + // 调用productionService的addProduction方法添加商品,并获取返回结果 + int result = productionService.addProduction(production); + // int result = 1; // 注释掉的代码,可能是用于测试的硬编码结果 + // 如果添加成功 + if (result == 1) { + // 显示添加成功的消息框 + JOptionPane.showMessageDialog(this, "添加成功", "提示", + JOptionPane.INFORMATION_MESSAGE); + // 关闭当前对话框 + this.dispose(); + } + // 如果返回结果为2,表示已存在该商品 + else if(result == 2){ + JOptionPane.showMessageDialog(this, "已存在该商品", "提示", + JOptionPane.ERROR_MESSAGE); + } + // 如果添加失败 + else { + // 显示添加失败的消息框 + JOptionPane.showMessageDialog(this, "出错!添加失败", "提示", + JOptionPane.ERROR_MESSAGE); + + } }/*else{ //更新 SupplierInf supplierInf= new SupplierInf(); @@ -283,39 +382,99 @@ public class ProductionDialog extends JDialog implements ActionListener { } }*/ - } else if (source == cancelBtn) { +// 如果事件源是取消按钮 + else if (source == cancelBtn) { + // 关闭当前对话框 + this.dispose(); + } - this.dispose(); - } - } - public class MyItemListener implements ItemListener { +// 定义一个内部类MyItemListener实现ItemListener接口,用于监听下拉列表选项的变化 + public class MyItemListener implements ItemListener { - @Override - public void itemStateChanged(ItemEvent e) { - JComboBox cb = (JComboBox) e.getSource(); - name2 = (String) cb.getSelectedItem(); - pci =new prodCatalogImpl(); - for(int i=0;i