网上书店完整代码(7)

2019-01-27 14:38

《网上书店信息管理系统的设计与实现》 第31页 共34页 }

package com.shoeShop.view;

import java.awt.event.ActionEvent; import java.awt.event.ActionListener;

import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField;

import com.shoeShop.dao.GoodsDao; import com.shoeShop.entity.Goods;

public class AddGoodsFrame extends JFrame{

private static final Goods Goods = null;

private JLabel lbName = new JLabel(\商品名:\private JLabel lbPrice = new JLabel(\价格:\private JLabel lbDiscount = new JLabel(\折扣:\private JLabel lbNum = new JLabel(\数量:\private JTextField fieldName = new JTextField(20); private JTextField fieldPrice = new JTextField(20); }

public static void setFlag(int flag) { }

User.flag = flag;

《网上书店信息管理系统的设计与实现》 第32页 共34页 //

private JTextField fieldDiscount = new JTextField(20); private JTextField fieldNum = new JTextField(20); private JButton btSure = new JButton(\确定\private JButton btCancel = new JButton(\取消\private Goods goods = new Goods();

public AddGoodsFrame(){ }

private void init(){ }

private void setContentPanel(){

lbName.setBounds(30, 30, 80, 30); fieldName.setBounds(130, 30, 150, 30); lbPrice.setBounds(30, 90, 80, 30); fieldPrice.setBounds(130, 90, 150, 30); lbDiscount.setBounds(30, 150, 80, 30); fieldDiscount.setBounds(130, 150, 150, 30); lbNum.setBounds(30, 200, 80, 30); this.setSize(320, 330); this.setTitle(\商品添加\

this.setIconImage(new ImageIcon(\this.setLayout(null);

this.setLocationRelativeTo(null); this.setResizable(false);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(null); setContentPanel(); init();

《网上书店信息管理系统的设计与实现》 第33页 共34页

fieldNum.setBounds(130, 200, 150, 30); btCancel.setBounds(30, 250, 70, 30); btSure.setBounds(210, 250, 70, 30); this.add(lbName); this.add(fieldName); this.add(lbPrice); this.add(fieldPrice); this.add(lbDiscount); this.add(fieldDiscount); this.add(lbNum); this.add(fieldNum); this.add(btCancel); this.add(btSure);

btCancel.addActionListener(new ActionListener() { });

btSure.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

if(JOptionPane.showConfirmDialog(null, \您确定要添加吗?\

GoodsDao dao = new GoodsDao();

goods.setDiscount(Integer.valueOf(fieldDiscount.getText())); goods.setName(fieldName.getText());

goods.setNum(Integer.valueOf(fieldNum.getText())); goods.setPrice(Integer.valueOf(fieldPrice.getText()));

@Override

public void actionPerformed(ActionEvent e) { }

// TODO Auto-generated method stub setVisible(false);

《网上书店信息管理系统的设计与实现》 第34页 共34页 }

package com.shoeShop.view;

public static void main(String[] args) { }

UpdateFrame frame = new UpdateFrame(); frame.setVisible(true);

public void setGoods(Goods goods) { }

this.goods = goods; }

public Goods getGoods() { }

return goods; });

}

dao.insertGoods(goods); setVisible(false);

JOptionPane.showMessageDialog(null, \添加成功!\

}else{ }

//

《网上书店信息管理系统的设计与实现》 第35页 共34页

import java.awt.BorderLayout; import java.awt.Color;

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList;

import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField;

import com.shoeShop.dao.GoodsDao; import com.shoeShop.dao.OrderDao; import com.shoeShop.entity.Goods; import com.shoeShop.entity.Order;

public class BuyerFrame extends JFrame{

private JPanel goodsPanel = new JPanel();//中间面板 private JPanel orderPanel = new JPanel();//订单面板

private JPanel southPanel = new JPanel();//南边用于方按钮的面板


网上书店完整代码(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2018-2019农村信用联社201X年工作计划安排-优秀word范文(2页)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: