package org.crazyit.book.ui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.Vector;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import org.crazyit.book.commons.BusinessException;
import org.crazyit.book.service.BookService;
import org.crazyit.book.service.SaleRecordService;
import org.crazyit.book.vo.Book;
import org.crazyit.book.vo.BookSaleRecord;
import org.crazyit.book.vo.SaleRecord;
/**
* 销售界面
*
* @author yangenxiong yangenxiong2009@gmail.com
* @version 1.0
* <br/>网站: <a href="http://www.crazyit.org">疯狂Java联盟</a>
* <br>Copyright (C), 2009-2010, yangenxiong
* <br>This program is protected by copyright laws.
*/
public class SalePanel extends CommonPanel {
BookService bookService;
//销售记录列
Vector columns;
//书的销售记录列
Vector bookSaleRecordColumns;
//销售记录的业务接口
SaleRecordService saleRecordService;
//书的交易记录列表
JTable bookSaleRecordTable;
//书本选择的下拉框
JComboBox bookComboBox;
//书的销售记录数据
Vector<BookSaleRecord> bookSaleRecordDatas;
//销售记录的id文本框
JTextField saleRecordId;
//销售记录总价
JTextField totalPrice;
//销售日期
JTextField recordDate;
//销售总数量
JTextField amount;
//清空按钮
JButton clearButton;
//书的单价
JLabel singlePrice;
//购买书的数量
JTextField bookAmount;
//书对应的库存
JLabel repertorySize;
//添加书的按钮
JButton addBookButton;
//删除书的按钮
JButton deleteBookButton;
//成交按钮
JButton confirmButton;
//查询按钮
JButton queyrButton;
//查询输入的日期
JTextField queryDate;
//日期格式
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//时间格式
private SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
private void initColumns() {
//初始化销售记录列表的列
this.columns = new Vector();
this.columns.add("id");
this.columns.add("购买书本");
this.columns.add("总价");
this.columns.add("交易日期");
this.columns.add("总数量");
//初始化销售记录中书列表的列
this.bookSaleRecordColumns = new Vector();
this.bookSaleRecordColumns.add("id");
this.bookSaleRecordColumns.add("书名");
this.bookSaleRecordColumns.add("单价");
this.bookSaleRecordColumns.add("数量");
this.bookSaleRecordColumns.add("bookId");
}
public SalePanel(BookService bookService, SaleRecordService saleRecordService) {
this.bookService = bookService;
this.saleRecordService = saleRecordService;
//设置列表数据
setViewDatas();
//初始化列
initColumns();
//设置列表
DefaultTableModel model = new DefaultTableModel(datas, columns);
JTable table = new CommonJTable(model);
setJTable(table);
JScrollPane upPane = new JScrollPane(table);
upPane.setPreferredSize(new Dimension(1000, 350));
//设置添加, 修改的界面
JPanel downPane = new JPanel();
downPane.setLayout(new BoxLayout(downPane, BoxLayout.Y_AXIS));
/*******************************************************/
Box downBox1 = new Box(BoxLayout.X_AXIS);
this.saleRecordId = new JTextField(10);
downBox1.add(this.saleRecordId);
this.saleRecordId.setVisible(false);
//列表下面的box
downBox1.add(new JLabel("总价:"));
this.totalPrice = new JTextField(10);
this.totalPrice.setEditable(false);
downBox1.add(this.totalPrice);
downBox1.add(new JLabel(" "));
downBox1.add(new JLabel("交易日期:"));
this.recordDate = new JTextField(10);
this.recordDate.setEditable(false);
//设置当前交易时间
setRecordDate();
downBox1.add(this.recordDate);
downBox1.add(new JLabel(" "));
downBox1.add(new JLabel("总数量:"));
this.amount = new JTextField(10);
this.amount.setEditable(false);
downBox1.add(this.amount);
downBox1.add(new JLabel(" "));
/*******************************************************/
//书列表
Box downBox2 = new Box(BoxLayout.X_AXIS);
this.bookSaleRecordDatas = new Vector();
DefaultTableModel bookModel = new DefaultTableModel(this.bookSaleRecordDatas,
this.bookSaleRecordColumns);
this.bookSaleRecordTable = new CommonJTable(bookModel);
//设置书本交易记录列表的样式
setBookSaleRecordTableFace();
JScrollPane bookScrollPane = new JScrollPane(this.bookSaleRecordTable);
bookScrollPane.setPreferredSize(new Dimension(1000, 120));
downBox2.add(bookScrollPane);
/*******************************************************/
Box downBox3 = new Box(BoxLayout.X_AXIS);
downBox3.add(Box.createHorizontalStrut(100));
downBox3.add(new JLabel("书本:"));
downBox3.add(Box.createHorizontalStrut(20));
//创建界面中书的下拉框
this.bookComboBox = new JComboBox();
//为下拉框添加数据
buildBooksComboBox();
downBox3.add(this.bookComboBox);
downBox3.add(Box.createHorizontalStrut(50));
downBox3.add(new JLabel("数量:"));
downBox3.add(Box.createHorizontalStrut(20));
this.bookAmount = new JTextField(10);
downBox3.add(this.bookAmount);
downBox3.add(Box.createHorizontalStrut(50));
downBox3.add(new JLabel("单价:"));
downBox3.add(Box.createHorizontalStrut(20));
this.singlePrice = new JLabel();
downBox3.add(this.singlePrice);
downBox3.add(Box.createHorizontalStrut(100));
downBox3.add(new JLabel("库存:"));
downBox3.add(Box.createHorizontalStrut(20));
this.repertorySize = new JLabel();
downBox3.add(this.repertorySize);
downBox3.add(Box.createHorizontalStrut(80));
this.addBookButton = new JButton("添加");
downBox3.add(this.addBookButton);
downBox3.add(Box.createHorizontalStrut(30));
this.deleteBookButton = new JButton("删除");
downBox3.add(this.deleteBookButton);
/*******************************************************/
Box downBox4 = new Box(BoxLayout.X_AXIS);
this.confirmButton = new JButton("成交");
downBox4.add(this.confirmButton);
downBox4.add(Box.createHorizontalStrut(120));
clearButton = new JButton("清空");
downBox4.add(clearButton);
/*******************************************************/
downPane.add(getSplitBox());
downPane.add(downBox1);
downPane.add(getSplitBox());
downPane.add(downBox2);
downPane.add(getSplitBox());
downPane.add(downBox3);
downPane.add(getSplitBox());
downPane.add(downBox4);
/*******************查询******************/
JPanel queryPanel = new JPanel();
Box queryBox = new Box(BoxLayout.X_AXIS);
queryBox.add(new JLabel("日期:"));
queryBox.add(Box.createHorizontalStrut(30));
this.queryDate = new JTextField(20);
queryBox.add(this.queryDate);
queryBox.add(Box.createHorizontalStrut(30));
this.queyrButton = new JButton("查询");
queryBox.add(this.queyrButton);
queryPanel.add(queryBox);
this.add(queryPanel);
//列表为添加界面
JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upPane, downPane);
split.setDividerSize(5);
this.add(split);
//初始化监听器
initListeners();
}
//初始化监听器
private void initListeners() {
//表格选择监听器
getJTable().getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent event) {
//当选择行时鼠标释放时才执行
if (!event.getValueIsAdjusting()) {
//如果没有选中任何一行, 则返回
if (getJTable().getSelectedRowCount() != 1) return;
view();
}
}
});
//清空按钮监听器
this.clearButton.addActionListener(new ActionListener(){
public voi
没有合适的资源?快使用搜索试试~ 我知道了~
java图书进存销系统
共189个文件
class:97个
java:59个
png:12个
5星 · 超过95%的资源 需积分: 9 55 下载量 86 浏览量
2011-06-14
16:37:18
上传
评论 1
收藏 2.11MB RAR 举报
温馨提示
java图书进存销系统,java图书进存销系统,java图书进存销系统,java图书进存销系统,java图书进存销系统,java图书进存销系统,java图书进存销系统,java图书进存销系统.
资源推荐
资源详情
资源评论
收起资源包目录
java图书进存销系统 (189个子文件)
startup.bat 221B
SalePanel.class 14KB
BookPanel.class 14KB
RepertoryPanel.class 13KB
ConcernPanel.class 8KB
TypePanel.class 7KB
SaleRecordServiceImpl.class 6KB
MainFrame.class 6KB
InRecordServiceImpl.class 5KB
DataUtil.class 4KB
LoginFrame.class 3KB
BookDaoImpl.class 3KB
BookServiceImpl.class 3KB
Book.class 3KB
ConcernDaoImpl.class 3KB
CommonPanel.class 3KB
TypeDaoImpl.class 3KB
JDBCExecutor.class 2KB
ImageUtil.class 2KB
SaleRecordDaoImpl.class 2KB
InRecordDaoImpl.class 2KB
BookSaleRecordDaoImpl.class 2KB
BookInRecordDaoImpl.class 2KB
SaleRecord.class 2KB
BookSaleRecord.class 2KB
BookInRecord.class 2KB
ConcernServiceImpl.class 2KB
InRecord.class 1KB
TypeServiceImpl.class 1KB
Concern.class 1KB
UserDaoImpl.class 1KB
CommonDaoImpl.class 1KB
PropertiesUtil.class 1KB
ConcernPanel$1.class 1KB
TypePanel$3.class 1KB
TypePanel$1.class 1KB
MainFrame$3.class 1KB
BookPanel$3.class 1KB
BookPanel$8.class 1KB
BookPanel$7.class 1KB
RepertoryPanel$1.class 1KB
UserServiceImpl.class 1KB
RepertoryPanel$7.class 1019B
BookPanel$1.class 1017B
SalePanel$1.class 1017B
TypePanel$4.class 1005B
MainFrame$2.class 1000B
MainFrame$5.class 996B
Type.class 991B
MainFrame$1.class 990B
MainFrame$4.class 990B
SalePanel$8.class 989B
DateUtil.class 954B
ImageFrame.class 946B
Main.class 838B
User.class 794B
RepertoryPanel$2.class 771B
RepertoryPanel$4.class 771B
RepertoryPanel$5.class 771B
RepertoryPanel$6.class 771B
RepertoryPanel$3.class 771B
ConcernPanel$4.class 762B
ConcernPanel$3.class 762B
ConcernPanel$2.class 759B
LoginFrame$1.class 744B
BookPanel$5.class 741B
TypePanel$2.class 741B
SalePanel$7.class 741B
SalePanel$6.class 741B
SalePanel$3.class 741B
SalePanel$5.class 741B
SalePanel$4.class 741B
BookPanel$4.class 741B
SalePanel$2.class 741B
BookPanel$2.class 738B
BookPanel$6.class 711B
FileChooser.class 698B
CommonJTable.class 661B
BookDao.class 585B
ConcernService.class 562B
ValueObject.class 547B
ConcernDao.class 545B
TypeService.class 540B
BookService.class 539B
TypeDao.class 517B
SaleRecordDao.class 473B
InRecordDao.class 463B
SaleRecordService.class 425B
InRecordService.class 409B
BookSaleRecordDao.class 399B
BusinessException.class 394B
DataException.class 388B
UploadException.class 388B
QueryException.class 385B
JDBCException.class 382B
BookInRecordDao.class 375B
UserDao.class 201B
UserService.class 186B
.classpath 305B
第9章 图书进存销系统.doc 725KB
共 189 条
- 1
- 2
资源评论
- WOWmeSS2013-12-07很不错,果断5分,但是有异常哎~~
- fzil0012013-03-19好吧。我天真了,还以为是实际项目。。。
八戒你又瘦了
- 粉丝: 4
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- NT98336 SDK 114版本
- torch-1.8.1+cu111-cp38-cp38-linux-x86-64.whl +torchvision
- 计算机设计 - VB+ACCESS网络计时管理系统设计(源代码+系统),保证可靠运行,毕业生可参考,免费资源下载
- 计算机设计 - vb+ACCESS身份证管理系统设计(LW+源代码),保证可靠运行,毕业生可参考,免费资源下载
- ARCMAP自动编号工具
- W801学习笔记十三:掌机系统-系统基础组件-PNG-loader
- studydatastruct3
- XHS链接提取/作品采集工具
- general-exporter windows
- kotlin语法快速入门文档
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功