package mainframe;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.SQLException;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import dao.ShopStorageDAO;
/**
* This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
* Builder, which is free for non-commercial use. If Jigloo is being used
* commercially (ie, by a corporation, company or business for any purpose
* whatever) then you should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details. Use of Jigloo implies
* acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
* PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
* ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class GoodsManagerDialog extends javax.swing.JDialog {
/**
*
*/
private static final long serialVersionUID = 1L;
// 界面上相关无素的定义
private JPanel goodsManagerPanel;
private JButton updateButton;
private JPopupMenu findPopupMenu;
private JTable goodsListTable;
private JLabel goodInfLabel;
private JButton findButton;
private JButton deleteButton;
private JButton addButton;
private JScrollPane goodsManagerScrollPane1;
// 弹出式菜单的定义
private JMenuItem findAllMenuItem;
private JMenuItem findtype1MenuItem;
private JMenuItem findtype2MenuItem;
private JMenuItem findtype3MenuItem;
private JMenuItem findtype4MenuItem;
// 表格数据模型的定义
private Vector<Vector<String>> goodsList;
private Vector<Object> goodsHeader;
private TableModel goodsListTableModel;
// 数据访问对象的定义
private ShopStorageDAO dao;
// 添加修改子对话框的定义
private AddUpDelDialog addDialog;
// 是否选择了修改行
private boolean isSelected;
// 要查找的商品类型
private String findType;
// 构造方法
public GoodsManagerDialog(JFrame frame) {
super(frame);
this.goodsList = new Vector<Vector<String>>();
this.goodsHeader = new Vector<Object>();
this.dao = new ShopStorageDAO();
this.addDialog = new AddUpDelDialog();
this.isSelected = false;
this.findType = "";
initGUI();
}
private void initGUI() {
try {
{
this.goodsHeader.add("商品名称");
this.goodsHeader.add("商品单价");
this.goodsHeader.add("商品分类");
this.goodsHeader.add("商品库存");
}
this.setTitle("商品管理");// 购物服务端
{
goodsManagerPanel = new JPanel();
getContentPane().add(goodsManagerPanel, BorderLayout.CENTER);
goodsManagerPanel.setLayout(null);
{
addButton = new JButton();
goodsManagerPanel.add(addButton);
addButton.setText("\u589e\u52a0");
addButton.setBounds(42, 21, 91, 35);
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
addButtonActionPerformed(evt);
}
});
}
{
updateButton = new JButton();
goodsManagerPanel.add(updateButton);
updateButton.setText("\u4fee\u6539");
updateButton.setBounds(182, 21, 91, 35);
updateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
updateButtonActionPerformed(evt);
}
});
}
{
deleteButton = new JButton();
goodsManagerPanel.add(deleteButton);
deleteButton.setText("\u5220\u9664");
deleteButton.setBounds(329, 21, 91, 35);
deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
deleteButtonActionPerformed(evt);
}
});
}
{
findButton = new JButton();
goodsManagerPanel.add(findButton);
findButton.setText("\u67e5\u8be2");
findButton.setBounds(483, 21, 91, 35);
findButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
findButtonActionPerformed(evt);
}
});
}
{
goodInfLabel = new JLabel();
goodsManagerPanel.add(goodInfLabel);
goodInfLabel.setText("\u5546\u54c1\u4fe1\u606f\uff1a");
goodInfLabel.setBounds(42, 70, 98, 28);
}
{
goodsManagerScrollPane1 = new JScrollPane();
goodsManagerPanel.add(goodsManagerScrollPane1);
goodsManagerScrollPane1.setBounds(49, 112, 532, 294);
{
goodsListTableModel = new DefaultTableModel(goodsList,
goodsHeader) {
private static final long serialVersionUID = 1L;
public boolean isCellEditable(int row, int column) {
return false;
}
};
goodsListTable = new JTable();
goodsManagerScrollPane1.setViewportView(goodsListTable);
goodsListTable.setModel(goodsListTableModel);
goodsListTable.setBounds(392, 21, 532, 287);
goodsListTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
goodsListTable1MouseClicked(evt);
}
});
}
}
{
findPopupMenu = new JPopupMenu();
{
findAllMenuItem = new JMenuItem();
findPopupMenu.add(findAllMenuItem);
findAllMenuItem.setText("查询全部");
findAllMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
findAllMenuItemActionPerformed(evt);
}
});
}
{
findtype1MenuItem = new JMenuItem();
findPopupMenu.add(findtype1MenuItem);
findtype1MenuItem.setText("查询饮料");
findtype1MenuItem
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
findType1MenuItemActionPerformed(evt);
}
});
}
{
findtype2MenuItem = new JMenuItem();
findPopupMenu.add(findtype2MenuItem);
findtype2MenuItem.setText("查询香烟");
findtype2MenuItem
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
findType2MenuItemActionPerformed(evt);
}
});
}
{
findtype3MenuItem = new JMenuItem();
findPopupMenu.add(findtype3MenuItem);
findtype3MenuItem.setText("查询点卡");
findtype3MenuItem
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
findType3MenuItemActionPerformed(evt);
}
});
}
{
findtype4MenuItem = new JMenuItem();
findPopupMenu.add(findtype4MenuItem);
findtype4MenuItem.setText("查询食物");
findtype4MenuItem
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
findType4MenuItemActionPerformed(evt);
}
});
}
setComponentPopupMenu(goodsManagerPanel, findPopupMenu);
}
}
this.setSize(629, 459);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Auto-generated method for setting the popup menu for a component
*/
//弹出式菜单的单击显示事件
private void setComponentPopupMenu(final java.awt.Component parent,
final javax.swing.JPopupMenu menu) {
parent.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent e) {
if (e.isPopupTrigger())
menu.show(parent, e.getX(), e.getY());
}
public void mouseReleased(java.awt.event.MouseEvent e) {
if (e.isPopupTrigger())
menu.show(parent, e.getX(), e.getY());
}
});
}
/* 添加按钮事件 */
private void addButtonActionPerformed(ActionEvent evt) {
/* 使用新的对话框,所有数据都为空 */
AddUpDelDialog addDialog = new AddUpDelDialog();
addDialog.setModal(true);
addDialog.setLocation(70, 50);
addDialog.getTitleLa
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
WebBarShop_Server.rar (46个子文件)
WebBarShop_Server
bin
dao
ShopStorageDAO.class 9KB
obj
ShopTable.class 2KB
FinalConst.class 381B
socket
ShopServer.class 8KB
ShopClient.class 3KB
mainframe
ShopMainFrame$4.class 771B
GoodsManagerDialog.class 10KB
ShopMainFrame$2.class 695B
GoodsManagerDialog$5.class 870B
AddUpDelDialog.class 7KB
GoodsManagerDialog$1.class 806B
AddUpDelDialog$2.class 778B
ShopMainFrame$7.class 771B
GoodsManagerDialog$10.class 808B
ShopMainFrame$5.class 771B
ShopMainFrame$8.class 771B
GoodsManagerDialog$7.class 806B
GoodsManagerDialog$9.class 806B
GoodsManagerDialog$8.class 806B
GoodsManagerDialog$2.class 806B
ShopMainFrame$9.class 843B
GoodsManagerDialog$3.class 806B
GoodsManagerDialog$13.class 892B
ShopMainFrame.class 8KB
GoodsManagerDialog$4.class 806B
ShopMainFrame$1.class 840B
GoodsManagerDialog$6.class 730B
GoodsManagerDialog$12.class 1KB
AddUpDelDialog$1.class 778B
GoodsManagerDialog$11.class 808B
ShopMainFrame$3.class 771B
ShopMainFrame$6.class 739B
cfg.xml 313B
jdom.jar 150KB
src
dao
ShopStorageDAO.java 9KB
obj
FinalConst.java 552B
ShopTable.java 1KB
socket
ShopServer.java 9KB
ShopClient.java 4KB
mainframe
AddUpDelDialog.java 7KB
GoodsManagerDialog.java 12KB
ShopMainFrame.java 10KB
.project 393B
.classpath 328B
WebBar_Shop.mdb 236KB
xerces.jar 937KB
共 46 条
- 1
资源评论
- yida5102014-12-23这不是我想要的
- 疯狂的毛毛雨2011-09-18朋友,我下载了一份,正在看,另外能发一份客户端的吗?谢谢。我的邮箱459221518@qq.com,再谢
- juejiang082015-07-14不知道怎么回事我的这边运行不了
- qq_206800452015-05-02挺好的,我在做毕业设计,正缺它,谢了
andyliulifei
- 粉丝: 24
- 资源: 106
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功