Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
玉米子禾
BlueRabbitLibrarySystem
提交
d2d31484
B
BlueRabbitLibrarySystem
项目概览
玉米子禾
/
BlueRabbitLibrarySystem
10 个月 前同步成功
通知
52
Star
6
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
BlueRabbitLibrarySystem
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d2d31484
编写于
3月 10, 2023
作者:
玉米子禾
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整好还入界面布局
上级
b3ca0640
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
427 addition
and
417 deletion
+427
-417
.idea/workspace.xml
.idea/workspace.xml
+1
-1
src/com/bluerabbit/librarysystem/view/BookInfoManageView.java
...com/bluerabbit/librarysystem/view/BookInfoManageView.java
+270
-269
src/com/bluerabbit/librarysystem/view/borrow/BorrowInView.java
...om/bluerabbit/librarysystem/view/borrow/BorrowInView.java
+156
-147
未找到文件。
.idea/workspace.xml
浏览文件 @
d2d31484
...
...
@@ -83,7 +83,7 @@
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1678258258162
</updated>
<workItem
from=
"1678258261101"
duration=
"4342000"
/>
<workItem
from=
"1678263081204"
duration=
"5
4134
000"
/>
<workItem
from=
"1678263081204"
duration=
"5
6932
000"
/>
</task>
<servers
/>
</component>
...
...
src/com/bluerabbit/librarysystem/view/BookInfoManageView.java
浏览文件 @
d2d31484
...
...
@@ -30,128 +30,129 @@ import com.bluerabbit.librarysystem.listener.BookInfoManageView_Fix_MouseListene
import
com.bluerabbit.librarysystem.listener.BookInfoManageView_adSearch_ActionListener
;
import
com.bluerabbit.librarysystem.listener.BookInfoManageView_exeInquire_MouseListener
;
import
com.bluerabbit.librarysystem.listener.BookInfoManageView_tableView_MouseListener
;
/**
* 图书管理界面
* @author minuy
*
* @author minuy
*/
@SuppressWarnings
(
"serial"
)
public
class
BookInfoManageView
extends
JDialog
{
private
int
WindowsHeight
;
private
int
windowsWidth
;
private
int
buttonSize
=
50
;
private
JPanel
bookView
;
private
JPanel
buttonView
;
private
JPanel
toolView
;
private
JPanel
tableView
;
private
JPanel
InfoView
;
private
JLabel
Badd
;
private
JLabel
Bfix
;
private
JLabel
Bdel
;
private
JLabel
Bclo
;
private
JLabel
inqTipWay
;
private
JLabel
inqTipInfo
;
private
JComboBox
<
String
>
chooseWay
;
private
JTextField
chooseInfo
;
private
JButton
exeInquire
;
private
JLabel
labPerch
;
private
JButton
adSearch
;
private
MyTable
tableDataView
;
private
DefaultTableModel
dtmView
;
private
JScrollPane
snpView
;
public
BookInfoManageView
(
MainView
mv
)
{
super
(
mv
,
"图书信息管理"
,
true
);
WindowsHeight
=
mv
.
getHeight
();
windowsWidth
=
mv
.
getWidth
();
bookView
=
new
JPanel
();
buttonView
=
new
JPanel
();
Badd
=
new
JLabel
(
"增加"
);
Bfix
=
new
JLabel
(
"修改"
);
Bdel
=
new
JLabel
(
"删除"
);
Bclo
=
new
JLabel
(
"关闭"
);
InfoView
=
new
JPanel
();
toolView
=
new
JPanel
();
inqTipWay
=
new
JLabel
(
"选择搜索方式"
);
inqTipInfo
=
new
JLabel
(
"输入图书信息搜索"
);
chooseWay
=
new
JComboBox
<
String
>();
chooseInfo
=
new
JTextField
();
exeInquire
=
new
JButton
(
"搜索一下"
);
labPerch
=
new
JLabel
(
" "
);
//占位符
adSearch
=
new
JButton
(
"高级搜索"
);
tableView
=
new
JPanel
();
snpView
=
new
JScrollPane
();
tableDataView
=
new
MyTable
();
/**视图结构表
* bookView = new JPanel();
buttonView = new JPanel();
Badd = new JLabel("增加");
Bfix = new JLabel("修改");
Bdel = new JLabel("删除");
Bclo = new JLabel("关闭");
InfoView = new JPanel();
toolView = new JPanel();
inqTipWay = new JLabel("选择搜索方式");
inqTipInfo = new JLabel("输入图书信息搜索");
chooseWay = new JComboBox();
chooseInfo = new JTextField();
exeInquire = new JLabel("搜索一下");
adSearch = new JButton("高级搜索");
tableView = new JPanel();
snpView = new JScrollPane();
tableDataView = new JTable();
*/
Init
();
}
private
void
Init
()
{
// TODO Auto-generated method stub
this
.
setDefaultCloseOperation
(
JDialog
.
DISPOSE_ON_CLOSE
);
this
.
setSize
(
windowsWidth
-
100
,
WindowsHeight
-
100
);
CenterView
.
CenterByWindow
(
this
);
//不允许用户调整窗口大小
this
.
setResizable
(
false
);
//边界布局
bookView
.
setLayout
(
new
BorderLayout
());
//流水布局
buttonView
.
setLayout
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
//边界布局
InfoView
.
setLayout
(
new
BorderLayout
());
//流水布局
toolView
.
setLayout
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
//表格布局
tableView
.
setLayout
(
new
GridLayout
(
1
,
1
));
//按钮栏的处理
private
int
WindowsHeight
;
private
int
windowsWidth
;
private
int
buttonSize
=
50
;
private
JPanel
bookView
;
private
JPanel
buttonView
;
private
JPanel
toolView
;
private
JPanel
tableView
;
private
JPanel
InfoView
;
private
JLabel
Badd
;
private
JLabel
Bfix
;
private
JLabel
Bdel
;
private
JLabel
Bclo
;
private
JLabel
inqTipWay
;
private
JLabel
inqTipInfo
;
private
JComboBox
<
String
>
chooseWay
;
private
JTextField
chooseInfo
;
private
JButton
exeInquire
;
private
JLabel
labPerch
;
private
JButton
adSearch
;
private
MyTable
tableDataView
;
private
DefaultTableModel
dtmView
;
private
JScrollPane
snpView
;
public
BookInfoManageView
(
MainView
mv
)
{
super
(
mv
,
"图书信息管理"
,
true
);
WindowsHeight
=
mv
.
getHeight
();
windowsWidth
=
mv
.
getWidth
();
bookView
=
new
JPanel
();
buttonView
=
new
JPanel
();
Badd
=
new
JLabel
(
"增加"
);
Bfix
=
new
JLabel
(
"修改"
);
Bdel
=
new
JLabel
(
"删除"
);
Bclo
=
new
JLabel
(
"关闭"
);
InfoView
=
new
JPanel
();
toolView
=
new
JPanel
();
inqTipWay
=
new
JLabel
(
"选择搜索方式"
);
inqTipInfo
=
new
JLabel
(
"输入图书信息搜索"
);
chooseWay
=
new
JComboBox
<
String
>();
chooseInfo
=
new
JTextField
();
exeInquire
=
new
JButton
(
"搜索一下"
);
labPerch
=
new
JLabel
(
" "
);
//占位符
adSearch
=
new
JButton
(
"高级搜索"
);
tableView
=
new
JPanel
();
snpView
=
new
JScrollPane
();
tableDataView
=
new
MyTable
();
/**视图结构表
* bookView = new JPanel();
buttonView = new JPanel();
Badd = new JLabel("增加");
Bfix = new JLabel("修改");
Bdel = new JLabel("删除");
Bclo = new JLabel("关闭");
InfoView = new JPanel();
toolView = new JPanel();
inqTipWay = new JLabel("选择搜索方式");
inqTipInfo = new JLabel("输入图书信息搜索");
chooseWay = new JComboBox();
chooseInfo = new JTextField();
exeInquire = new JLabel("搜索一下");
adSearch = new JButton("高级搜索");
tableView = new JPanel();
snpView = new JScrollPane();
tableDataView = new JTable();
*/
Init
();
}
private
void
Init
()
{
// TODO Auto-generated method stub
this
.
setDefaultCloseOperation
(
JDialog
.
DISPOSE_ON_CLOSE
);
this
.
setSize
(
windowsWidth
-
100
,
WindowsHeight
-
100
);
CenterView
.
CenterByWindow
(
this
);
//不允许用户调整窗口大小
this
.
setResizable
(
false
);
//边界布局
bookView
.
setLayout
(
new
BorderLayout
());
//流水布局
buttonView
.
setLayout
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
//边界布局
InfoView
.
setLayout
(
new
BorderLayout
());
//流水布局
toolView
.
setLayout
(
new
FlowLayout
(
FlowLayout
.
LEFT
));
//表格布局
tableView
.
setLayout
(
new
GridLayout
(
1
,
1
));
//按钮栏的处理
// Badd.setBounds(0, 0, 80, 80);
// Bfix.setBounds(100, 0, 80, 80);
// Bdel.setBounds(180, 0, 80, 80);
// Bclo.setBounds(200, 0, 80, 80);
// buttonView.setLayout(null);
Badd
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
Bfix
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
Bdel
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
Bclo
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
buttonView
.
add
(
Badd
);
buttonView
.
add
(
Bfix
);
buttonView
.
add
(
Bdel
);
buttonView
.
add
(
Bclo
);
setJLabelImage
(
Badd
,
"res/book/Bookadd.png"
,
buttonSize
,
buttonSize
);
setJLabelImage
(
Bfix
,
"res/book/Bookfix.png"
,
buttonSize
,
buttonSize
);
setJLabelImage
(
Bdel
,
"res/book/Bookdel.png"
,
buttonSize
,
buttonSize
);
setJLabelImage
(
Bclo
,
"res/book/Bookclo.png"
,
buttonSize
,
buttonSize
);
//工具栏的处理
//提示text
Badd
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
Bfix
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
Bdel
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
Bclo
.
setPreferredSize
(
new
Dimension
(
buttonSize
,
buttonSize
));
buttonView
.
add
(
Badd
);
buttonView
.
add
(
Bfix
);
buttonView
.
add
(
Bdel
);
buttonView
.
add
(
Bclo
);
setJLabelImage
(
Badd
,
"res/book/Bookadd.png"
,
buttonSize
,
buttonSize
);
setJLabelImage
(
Bfix
,
"res/book/Bookfix.png"
,
buttonSize
,
buttonSize
);
setJLabelImage
(
Bdel
,
"res/book/Bookdel.png"
,
buttonSize
,
buttonSize
);
setJLabelImage
(
Bclo
,
"res/book/Bookclo.png"
,
buttonSize
,
buttonSize
);
//工具栏的处理
//提示text
// inqTipInfo.setBounds(0, 0, 180, 20);
// //text
// chooseInfo.setBounds(0, 30, 180, 20);
...
...
@@ -159,169 +160,169 @@ public class BookInfoManageView extends JDialog {
// inqTipWay.setBounds(0, 60, 180, 20);
// //combobox
// chooseWay.setBounds(0, 90, 180, 20);
chooseWay
.
addItem
(
"书刊编号"
);
chooseWay
.
addItem
(
"书刊名称"
);
chooseWay
.
addItem
(
"书刊作者"
);
chooseWay
.
addItem
(
"书刊编号"
);
chooseWay
.
addItem
(
"书刊名称"
);
chooseWay
.
addItem
(
"书刊作者"
);
// //button
// exeInquire.setBounds(0, 250, 180, 30);
// //ADsouch
// adSearch.setBounds(0, 300, 180, 30);
// toolView.setLayout(null);
toolView
.
add
(
inqTipWay
);
toolView
.
add
(
chooseWay
);
toolView
.
add
(
inqTipInfo
);
toolView
.
add
(
chooseInfo
);
chooseInfo
.
setPreferredSize
(
new
Dimension
(
100
,
30
));
toolView
.
add
(
exeInquire
);
toolView
.
add
(
labPerch
);
//设置大小
labPerch
.
setPreferredSize
(
new
Dimension
(
117
,
30
));
//边框
//exeInquire.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
toolView
.
add
(
adSearch
);
//为搜索按钮添加监听
exeInquire
.
addMouseListener
(
new
BookInfoManageView_exeInquire_MouseListener
(
this
));
//setJLabelImage(exeInquire,"res/BookInfo/sousuo2.png",197,27);
adSearch
.
addActionListener
(
new
BookInfoManageView_adSearch_ActionListener
(
this
));
//表格的处理
tableDataView
.
addMouseListener
(
new
BookInfoManageView_tableView_MouseListener
(
this
));
//获取数据
updateTableData
();
snpView
.
getViewport
().
add
(
tableDataView
);
tableView
.
add
(
snpView
);
bookView
.
add
(
buttonView
,
BorderLayout
.
NORTH
);
bookView
.
add
(
InfoView
,
BorderLayout
.
CENTER
);
InfoView
.
add
(
toolView
,
BorderLayout
.
NORTH
);
InfoView
.
add
(
snpView
,
BorderLayout
.
CENTER
);
//BookInfoManageView_Del_MouseListener bmv = new BookInfoManageView_Del_MouseListener(this);
//监听事件
Badd
.
addMouseListener
(
new
BookInfoManageView_Add_MouseListener
(
this
));
Bfix
.
addMouseListener
(
new
BookInfoManageView_Fix_MouseListener
(
this
));
Bdel
.
addMouseListener
(
new
BookInfoManageView_Del_MouseListener
(
this
));
Bclo
.
addMouseListener
(
new
BookInfoManageView_Clo_MouseListener
(
this
));
this
.
add
(
bookView
);
this
.
setVisible
(
true
);
}
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
void
setTableData
(
List
<
BookInfoBeans
>
list
)
{
// TODO Auto-generated method stub
//1.设置表格中的标题数据集合
Vector
<
String
>
title
=
new
Vector
<
String
>();
title
.
add
(
"书名"
);
title
.
add
(
"作者"
);
title
.
add
(
"书刊类别"
);
title
.
add
(
"出版社"
);
title
.
add
(
"出版版次"
);
title
.
add
(
"剩余册数"
);
title
.
add
(
"所在书室"
);
title
.
add
(
"所在书架"
);
title
.
add
(
"图书编号"
);
//2.设置表格中的数据集合
Vector
<
Vector
>
datas
=
new
Vector
<
Vector
>();
Vector
row
=
null
;
for
(
BookInfoBeans
b
:
list
)
{
row
=
new
Vector
();
row
.
add
(
b
.
getBookName
());
//书名
row
.
add
(
b
.
getAuthor
());
//作者
row
.
add
(
b
.
getBookClassify
());
//分类
row
.
add
(
b
.
getPublisher
());
//出版社
row
.
add
(
b
.
getPublishTime
());
//出版版次
row
.
add
(
b
.
getQuantity
());
//剩余册数
row
.
add
(
b
.
getStack
());
//所在书室
row
.
add
(
b
.
getBookShelf
());
//所在书架
row
.
add
(
b
.
getBookID
());
//图书编号
datas
.
add
(
row
);
}
//设置tableModel
this
.
dtmView
=
new
DefaultTableModel
(
datas
,
title
);
//将tableModel绑定在table上
this
.
tableDataView
.
setModel
(
dtmView
);
//设置表格自适应数据
tableDataView
.
FitTableColumns
();
}
public
void
setJLabelImage
(
JLabel
label
,
String
imagePath
,
int
w
,
int
h
)
{
//实例化ImageIcon 对象
ImageIcon
image
=
new
ImageIcon
(
imagePath
);
//得到Image对象
Image
img
=
image
.
getImage
();
//创建缩放版本
img
=
img
.
getScaledInstance
(
w
,
h
,
Image
.
SCALE_DEFAULT
);
//替换为缩放版本
image
.
setImage
(
img
);
//JLabel设置图像
label
.
setIcon
(
image
);
//设置默认边框
label
.
setBorder
(
BorderFactory
.
createEtchedBorder
(
EtchedBorder
.
LOWERED
));
}
//给监听类放通
public
JLabel
getBadd
()
{
return
Badd
;
}
public
JLabel
getBclo
()
{
return
Bclo
;
}
public
JLabel
getBdel
()
{
return
Bdel
;
}
public
JLabel
getBfix
()
{
return
Bfix
;
}
public
JTable
getTableDataView
()
{
return
tableDataView
;
}
//更新表单数据
public
void
updateTableData
()
{
// TODO Auto-generated method stub
//获取数据
BookInfoDAO
dao
=
new
BookInfoDAO
();
List
<
BookInfoBeans
>
list
=
dao
.
getAllBookInfo
();
//设置数据
setTableData
(
list
);
}
public
JButton
getExeInquire
()
{
// TODO Auto-generated method stub
return
this
.
exeInquire
;
}
public
JTextField
getChooseInfo
()
{
return
this
.
chooseInfo
;
}
public
JComboBox
<
String
>
getChooseWay
()
{
return
this
.
chooseWay
;
}
toolView
.
add
(
inqTipWay
);
toolView
.
add
(
chooseWay
);
toolView
.
add
(
inqTipInfo
);
toolView
.
add
(
chooseInfo
);
chooseInfo
.
setPreferredSize
(
new
Dimension
(
100
,
30
));
toolView
.
add
(
exeInquire
);
toolView
.
add
(
labPerch
);
//设置大小
labPerch
.
setPreferredSize
(
new
Dimension
(
117
,
30
));
//边框
//exeInquire.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
toolView
.
add
(
adSearch
);
//为搜索按钮添加监听
exeInquire
.
addMouseListener
(
new
BookInfoManageView_exeInquire_MouseListener
(
this
));
//setJLabelImage(exeInquire,"res/BookInfo/sousuo2.png",197,27);
adSearch
.
addActionListener
(
new
BookInfoManageView_adSearch_ActionListener
(
this
));
//表格的处理
tableDataView
.
addMouseListener
(
new
BookInfoManageView_tableView_MouseListener
(
this
));
//获取数据
updateTableData
();
snpView
.
getViewport
().
add
(
tableDataView
);
tableView
.
add
(
snpView
);
bookView
.
add
(
buttonView
,
BorderLayout
.
NORTH
);
bookView
.
add
(
InfoView
,
BorderLayout
.
CENTER
);
InfoView
.
add
(
toolView
,
BorderLayout
.
NORTH
);
InfoView
.
add
(
snpView
,
BorderLayout
.
CENTER
);
//BookInfoManageView_Del_MouseListener bmv = new BookInfoManageView_Del_MouseListener(this);
//监听事件
Badd
.
addMouseListener
(
new
BookInfoManageView_Add_MouseListener
(
this
));
Bfix
.
addMouseListener
(
new
BookInfoManageView_Fix_MouseListener
(
this
));
Bdel
.
addMouseListener
(
new
BookInfoManageView_Del_MouseListener
(
this
));
Bclo
.
addMouseListener
(
new
BookInfoManageView_Clo_MouseListener
(
this
));
this
.
add
(
bookView
);
this
.
setVisible
(
true
);
}
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
void
setTableData
(
List
<
BookInfoBeans
>
list
)
{
// TODO Auto-generated method stub
//1.设置表格中的标题数据集合
Vector
<
String
>
title
=
new
Vector
<
String
>();
title
.
add
(
"书名"
);
title
.
add
(
"作者"
);
title
.
add
(
"书刊类别"
);
title
.
add
(
"出版社"
);
title
.
add
(
"出版版次"
);
title
.
add
(
"剩余册数"
);
title
.
add
(
"所在书室"
);
title
.
add
(
"所在书架"
);
title
.
add
(
"图书编号"
);
//2.设置表格中的数据集合
Vector
<
Vector
>
datas
=
new
Vector
<
Vector
>();
Vector
row
=
null
;
for
(
BookInfoBeans
b
:
list
)
{
row
=
new
Vector
();
row
.
add
(
b
.
getBookName
());
//书名
row
.
add
(
b
.
getAuthor
());
//作者
row
.
add
(
b
.
getBookClassify
());
//分类
row
.
add
(
b
.
getPublisher
());
//出版社
row
.
add
(
b
.
getPublishTime
());
//出版版次
row
.
add
(
b
.
getQuantity
());
//剩余册数
row
.
add
(
b
.
getStack
());
//所在书室
row
.
add
(
b
.
getBookShelf
());
//所在书架
row
.
add
(
b
.
getBookID
());
//图书编号
datas
.
add
(
row
);
}
//设置tableModel
this
.
dtmView
=
new
DefaultTableModel
(
datas
,
title
);
//将tableModel绑定在table上
this
.
tableDataView
.
setModel
(
dtmView
);
//设置表格自适应数据
tableDataView
.
FitTableColumns
();
}
public
void
setJLabelImage
(
JLabel
label
,
String
imagePath
,
int
w
,
int
h
)
{
//实例化ImageIcon 对象
ImageIcon
image
=
new
ImageIcon
(
imagePath
);
//得到Image对象
Image
img
=
image
.
getImage
();
//创建缩放版本
img
=
img
.
getScaledInstance
(
w
,
h
,
Image
.
SCALE_DEFAULT
);
//替换为缩放版本
image
.
setImage
(
img
);
//JLabel设置图像
label
.
setIcon
(
image
);
//设置默认边框
label
.
setBorder
(
BorderFactory
.
createEtchedBorder
(
EtchedBorder
.
LOWERED
));
}
//给监听类放通
public
JLabel
getBadd
()
{
return
Badd
;
}
public
JLabel
getBclo
()
{
return
Bclo
;
}
public
JLabel
getBdel
()
{
return
Bdel
;
}
public
JLabel
getBfix
()
{
return
Bfix
;
}
public
JTable
getTableDataView
()
{
return
tableDataView
;
}
//更新表单数据
public
void
updateTableData
()
{
// TODO Auto-generated method stub
//获取数据
BookInfoDAO
dao
=
new
BookInfoDAO
();
List
<
BookInfoBeans
>
list
=
dao
.
getAllBookInfo
();
//设置数据
setTableData
(
list
);
}
public
JButton
getExeInquire
()
{
// TODO Auto-generated method stub
return
this
.
exeInquire
;
}
public
JTextField
getChooseInfo
()
{
return
this
.
chooseInfo
;
}
public
JComboBox
<
String
>
getChooseWay
()
{
return
this
.
chooseWay
;
}
}
src/com/bluerabbit/librarysystem/view/borrow/BorrowInView.java
浏览文件 @
d2d31484
...
...
@@ -35,7 +35,9 @@ public class BorrowInView extends JDialog {
// 借出设置
private
final
ComboJLAndJT
cltBorrowDuration
;
// 借出时长
private
final
ComboJLAndJT
cltBorrowNumber
;
// 借出数量
private
final
JPanel
jplBookStatus
;
private
final
JComboBox
<
String
>
jcbBookStatus
;
private
final
JLabel
jlbBookStatus
;
//图书状态
JLabel
jlbBorrowSetting
;
//借出设置
...
...
@@ -55,6 +57,7 @@ public class BorrowInView extends JDialog {
private
MyTable
tableDataView
;
private
DefaultTableModel
dtmView
;
private
JScrollPane
snpView
;
//读者信息
private
final
ComboJLAndJT
cltReaderId
;
// 学 号
...
...
@@ -71,8 +74,8 @@ public class BorrowInView extends JDialog {
public
BorrowInView
biv
;
private
final
String
[]
select
=
{
""
,
"男"
,
"女"
};
//性别框
private
final
String
[]
select
Sex
=
{
""
,
"男"
,
"女"
};
//性别框
private
final
String
[]
selectBookStatus
=
{
"正常"
,
"破损"
,
"破损严重"
,
"丢失"
};
//图书状态框 0正常,1破碎,2破损严重,3丢失
BorrowInServer
server
;
...
...
@@ -94,6 +97,7 @@ public class BorrowInView extends JDialog {
jplBookSearch
=
new
JPanel
();
bookInfo
=
new
JPanel
();
jplSex
=
new
JPanel
();
jplBookStatus
=
new
JPanel
();
jplBorrowSetting
=
new
JPanel
();
//读者信息搜索
...
...
@@ -107,22 +111,25 @@ public class BorrowInView extends JDialog {
jtfBookKeyword
=
new
JTextField
();
// 搜索输入框
jlbBook
=
new
JLabel
(
"已借阅书籍"
);
// 搜索输入框
btnSearchBook
=
new
JButton
(
"搜索"
);
// 搜索按钮
btnNextBook
=
new
JButton
(
"下一
个
"
);
// 下一个结果
btnPrevBook
=
new
JButton
(
"上一
个
"
);
// 上一个结果
btnNextBook
=
new
JButton
(
"下一
页
"
);
// 下一个结果
btnPrevBook
=
new
JButton
(
"上一
页
"
);
// 上一个结果
//表格的处理
snpView
=
new
JScrollPane
();
tableDataView
=
new
MyTable
();
//借出设置
cltBorrowDuration
=
new
ComboJLAndJT
(
"借出时长(天)"
,
30
,
true
);
//学号
cltBorrowNumber
=
new
ComboJLAndJT
(
"借出数量(本)"
,
30
,
true
);
//姓名
jlbBorrowSetting
=
new
JLabel
(
"借出设置"
);
//还入设置
jlbBorrowSetting
=
new
JLabel
(
"还入信息"
);
cltBorrowDuration
=
new
ComboJLAndJT
(
"支付费用"
,
20
,
true
);
//支付费用
jcbBookStatus
=
new
JComboBox
<>();
jlbBookStatus
=
new
JLabel
(
"图书状态:"
);
//图书状态
//个人信息 6
cltReaderId
=
new
ComboJLAndJT
(
"学 号:"
,
3
0
);
//学号
cltReaderName
=
new
ComboJLAndJT
(
"姓 名:"
,
3
0
);
//姓名
cltReaderApart
=
new
ComboJLAndJT
(
"学 院:"
,
3
0
);
//学院
cltReaderClass
=
new
ComboJLAndJT
(
"班 级:"
,
3
0
);
//班级
cltReaderTel
=
new
ComboJLAndJT
(
"联系方式:"
,
3
0
);
//联系方式
cltReaderId
=
new
ComboJLAndJT
(
"学 号:"
,
2
0
);
//学号
cltReaderName
=
new
ComboJLAndJT
(
"姓 名:"
,
2
0
);
//姓名
cltReaderApart
=
new
ComboJLAndJT
(
"学 院:"
,
2
0
);
//学院
cltReaderClass
=
new
ComboJLAndJT
(
"班 级:"
,
2
0
);
//班级
cltReaderTel
=
new
ComboJLAndJT
(
"联系方式:"
,
2
0
);
//联系方式
jcbSex
=
new
JComboBox
<>();
jcbSex
.
setEnabled
(
false
);
jlbSex
=
new
JLabel
(
"性 别:"
);
...
...
@@ -135,113 +142,9 @@ public class BorrowInView extends JDialog {
resetData
();
}
/**
* 更新书籍信息
*
* @param cp 未还书籍
* @param p 总借次数
* @param list 书籍信息
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
void
setBookInfo
(
int
cp
,
int
p
,
List
<
BookInfoBeans
>
list
)
{
// TODO Auto-generated method stub
//1.设置表格中的标题数据集合
Vector
<
String
>
title
=
new
Vector
<>();
title
.
add
(
"书名"
);
title
.
add
(
"作者"
);
title
.
add
(
"书刊类别"
);
title
.
add
(
"出版社"
);
title
.
add
(
"出版版次"
);
title
.
add
(
"剩余册数"
);
title
.
add
(
"所在书室"
);
title
.
add
(
"所在书架"
);
title
.
add
(
"图书编号"
);
//2.设置表格中的数据集合
Vector
<
Vector
>
data
=
new
Vector
<
Vector
>();
Vector
row
=
null
;
for
(
BookInfoBeans
b
:
list
)
{
row
=
new
Vector
<>();
row
.
add
(
b
.
getBookName
());
//书名
row
.
add
(
b
.
getAuthor
());
//作者
row
.
add
(
b
.
getBookClassify
());
//分类
row
.
add
(
b
.
getPublisher
());
//出版社
row
.
add
(
b
.
getPublishTime
());
//出版版次
row
.
add
(
b
.
getQuantity
());
//剩余册数
row
.
add
(
b
.
getStack
());
//所在书室
row
.
add
(
b
.
getBookShelf
());
//所在书架
row
.
add
(
b
.
getBookID
());
//图书编号
data
.
add
(
row
);
}
//设置tableModel
this
.
dtmView
=
new
DefaultTableModel
(
data
,
title
);
//将tableModel绑定在table上
this
.
tableDataView
.
setModel
(
dtmView
);
//设置表格自适应数据
tableDataView
.
FitTableColumns
();
if
(
p
==
0
){
jlbBook
.
setText
(
"暂未借阅书籍"
);
}
else
{
jlbBook
.
setText
(
"未归还书籍("
+
cp
+
"/"
+
p
+
")"
);
}
}
/**
* 更新读者信息
*
* @param cp 当前页数
* @param p 总页数
* @param beans 读者信息
*/
public
void
setReaderInfo
(
int
cp
,
int
p
,
ReaderInfoBeans
beans
)
{
//个人信息 6
cltReaderId
.
setIText
(
beans
.
getReaderID
());
//学号
cltReaderName
.
setIText
(
beans
.
getReaderName
());
//姓名
cltReaderApart
.
setIText
(
beans
.
getApart
());
//学院
cltReaderClass
.
setIText
(
beans
.
getTheClass
());
//班级
cltReaderTel
.
setIText
(
beans
.
getTelNo
());
//联系方式
if
(
"男"
.
equals
(
beans
.
getSex
()))
{
jcbSex
.
setSelectedIndex
(
1
);
}
else
if
(
"女"
.
equals
(
beans
.
getSex
()))
{
jcbSex
.
setSelectedIndex
(
2
);
}
jlbReader
.
setText
(
"读者搜索结果("
+
cp
+
"/"
+
p
+
")"
);
}
/**
* 重置数据
*/
public
void
resetData
()
{
// 借阅设置
jlbBook
.
setText
(
"已借阅书籍"
);
List
<
BookInfoBeans
>
beans
=
new
ArrayList
<>();
BookInfoBeans
infoBeans
=
new
BookInfoBeans
();
beans
.
add
(
infoBeans
);
setBookInfo
(
0
,
0
,
beans
);
//个人信息 6
cltReaderId
.
setIText
(
""
);
//学号
cltReaderName
.
setIText
(
""
);
//姓名
cltReaderApart
.
setIText
(
""
);
//学院
cltReaderClass
.
setIText
(
""
);
//班级
cltReaderTel
.
setIText
(
""
);
//班级
jcbSex
.
setSelectedIndex
(
0
);
jlbReader
.
setText
(
"读者信息"
);
}
private
void
Init
()
{
this
.
setDefaultCloseOperation
(
JDialog
.
DISPOSE_ON_CLOSE
);
this
.
setSize
(
windowsWidth
-
2
00
,
windowsHeight
-
20
);
this
.
setSize
(
windowsWidth
-
3
00
,
windowsHeight
-
20
);
CenterView
.
CenterByWindow
(
this
);
//不允许用户调整窗口大小
this
.
setResizable
(
false
);
...
...
@@ -256,16 +159,16 @@ public class BorrowInView extends JDialog {
//内容部分,h:wh-219,w:ww-130
int
unitH
=
(
windowsHeight
-
219
+
80
)
/
13
;
int
unitW
=
(
windowsWidth
-
154
-
1
00
);
int
unitW
=
(
windowsWidth
-
154
-
2
00
);
// -------------------------------------------------------------------------------------/
jplReaderSearch
.
setLayout
(
null
);
jplReaderSearch
.
setBounds
(
5
,
5
,
unitW
-
10
,
5
0
);
jplReaderSearch
.
setBounds
(
5
,
5
,
unitW
-
10
,
4
0
);
createSearchBar
(
unitW
,
jplReaderSearch
,
jlbReader
,
jtfReaderKeyword
,
btnSearchReader
,
btnPrevReader
,
btnNextReader
);
// -------------------------------------------------------------------------------------/
jplReaderInfo
.
setLayout
(
new
GridLayout
(
2
,
3
));
jplReaderInfo
.
setBounds
(
10
,
6
0
,
unitW
-
20
,
unitH
*
2
);
jplReaderInfo
.
setBounds
(
10
,
5
0
,
unitW
-
20
,
unitH
*
2
);
//个人信息 6
jplReaderInfo
.
add
(
cltReaderId
);
//学号
...
...
@@ -278,43 +181,48 @@ public class BorrowInView extends JDialog {
jplSex
.
add
(
jlbSex
);
jplSex
.
add
(
jcbSex
);
jplReaderInfo
.
add
(
jplSex
);
//性别
jcbSex
.
setModel
(
new
DefaultComboBoxModel
<>(
select
));
jcbSex
.
setPreferredSize
(
new
Dimension
(
1
8
7
,
27
));
jcbSex
.
setModel
(
new
DefaultComboBoxModel
<>(
select
Sex
));
jcbSex
.
setPreferredSize
(
new
Dimension
(
1
2
7
,
27
));
jplReaderInfo
.
add
(
cltReaderTel
);
//联系方式
// -------------------------------------------------------------------------------------/
jplBookSearch
.
setLayout
(
null
);
jplBookSearch
.
setBounds
(
5
,
unitH
*
2
+
60
+
10
,
unitW
-
10
,
5
0
);
jplBookSearch
.
setBounds
(
5
,
unitH
*
2
+
50
+
10
,
unitW
-
10
,
4
0
);
createSearchBar
(
unitW
,
jplBookSearch
,
jlbBook
,
jtfBookKeyword
,
btnSearchBook
,
btnPrevBook
,
btnNextBook
);
// 8
bookInfo
.
setLayout
(
new
GridLayout
(
5
,
2
));
bookInfo
.
setBounds
(
10
,
unitH
*
2
+
60
+
10
+
50
+
10
,
unitW
-
20
,
unitH
*
5
);
bookInfo
.
setLayout
(
new
GridLayout
(
1
,
1
));
bookInfo
.
setBounds
(
10
,
unitH
*
2
+
50
+
10
+
50
,
unitW
-
20
,
unitH
*
5
+
22
+
20
);
//bookInfo.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY));
bookInfo
.
add
(
tableDataView
);
snpView
.
getViewport
().
add
(
tableDataView
);
bookInfo
.
add
(
snpView
);
// -------------------------------------------------------------------------------------/
jplBorrowSetting
.
setLayout
(
null
);
jplBorrowSetting
.
setBounds
(
5
,
unitH
*
2
+
60
+
10
+
50
+
10
+
unitH
*
5
+
10
,
unitW
-
10
,
65
);
jplBorrowSetting
.
setBounds
(
5
,
unitH
*
2
+
60
+
10
+
50
+
10
+
unitH
*
5
+
10
+
22
,
unitW
-
10
,
40
);
jplBorrowSetting
.
setBorder
(
BorderFactory
.
createEtchedBorder
());
Color
color
=
new
Color
(
236
,
233
,
216
);
jplBorrowSetting
.
setBackground
(
color
);
//
借出
设置
//
还入
设置
jlbBorrowSetting
.
setFont
(
new
Font
(
Font
.
SERIF
,
Font
.
PLAIN
,
20
));
jlbBorrowSetting
.
setBounds
(
30
,
17
,
160
,
30
);
jlbBorrowSetting
.
setBounds
(
30
,
5
,
160
,
30
);
jplBorrowSetting
.
add
(
jlbBorrowSetting
);
//借出设置
cltBorrowDuration
.
setBounds
(
unitW
-
10
-
200
-
10
-
200
-
10
,
1
,
200
,
60
);
cltBorrowDuration
.
setBounds
(
unitW
-
10
-
200
-
10
-
200
-
10
,
1
,
200
,
35
);
cltBorrowDuration
.
setBackground
(
color
);
cltBorrowDuration
.
setIText
(
"
3
0"
);
jplBorrowSetting
.
add
(
cltBorrowDuration
);
//
借出时长
cltBorrowDuration
.
setIText
(
"0"
);
jplBorrowSetting
.
add
(
cltBorrowDuration
);
//
还入缴费
cltBorrowNumber
.
setBounds
(
unitW
-
10
-
200
-
10
,
1
,
200
,
60
);
cltBorrowNumber
.
setBackground
(
color
);
cltBorrowNumber
.
setIText
(
"1"
);
jplBorrowSetting
.
add
(
cltBorrowNumber
);
//借出数量
jcbBookStatus
.
setModel
(
new
DefaultComboBoxModel
<>(
selectBookStatus
));
jcbBookStatus
.
setPreferredSize
(
new
Dimension
(
127
,
27
));
jplBookStatus
.
setLayout
(
new
FlowLayout
());
jplBookStatus
.
add
(
jlbBookStatus
);
jplBookStatus
.
add
(
jcbBookStatus
);
jplBookStatus
.
setBackground
(
color
);
jplBookStatus
.
setBounds
(
unitW
-
10
-
200
-
10
,
1
,
200
,
35
);
jplBorrowSetting
.
add
(
jplBookStatus
);
//借出数量
// -------------------------------------------------------------------------------------/
...
...
@@ -362,21 +270,126 @@ public class BorrowInView extends JDialog {
jPanel
.
setBackground
(
new
Color
(
236
,
233
,
216
));
jLabel
.
setFont
(
new
Font
(
Font
.
SERIF
,
Font
.
PLAIN
,
20
));
jLabel
.
setBounds
(
30
,
10
,
240
,
30
);
jLabel
.
setBounds
(
30
,
5
,
240
,
30
);
jPanel
.
add
(
jLabel
);
jtfKeyword
.
setBounds
(
unitW
-
10
-
60
-
10
-
60
-
10
-
60
-
10
-
200
-
10
,
10
,
200
,
30
);
jtfKeyword
.
setBounds
(
unitW
-
10
-
60
-
10
-
60
-
10
-
60
-
10
-
200
-
10
,
5
,
200
,
30
);
jPanel
.
add
(
jtfKeyword
);
btnSearch
.
setBounds
(
unitW
-
10
-
60
-
10
-
60
-
10
-
60
-
10
,
10
,
60
,
30
);
btnSearch
.
setBounds
(
unitW
-
10
-
60
-
10
-
60
-
10
-
60
-
10
,
5
,
60
,
30
);
jPanel
.
add
(
btnSearch
);
btnPrev
.
setBounds
(
unitW
-
10
-
60
-
10
-
60
-
10
,
10
,
60
,
30
);
btnPrev
.
setBounds
(
unitW
-
10
-
60
-
10
-
60
-
10
,
5
,
60
,
30
);
jPanel
.
add
(
btnPrev
);
btnNext
.
setBounds
(
unitW
-
10
-
60
-
10
,
10
,
60
,
30
);
btnNext
.
setBounds
(
unitW
-
10
-
60
-
10
,
5
,
60
,
30
);
jPanel
.
add
(
btnNext
);
}
/**
* 更新书籍信息
*
* @param cp 未还书籍
* @param p 总借次数
* @param list 书籍信息
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
void
setBookInfo
(
int
cp
,
int
p
,
List
<
BookInfoBeans
>
list
)
{
// TODO Auto-generated method stub
//1.设置表格中的标题数据集合
Vector
<
String
>
title
=
new
Vector
<>();
title
.
add
(
"书名"
);
title
.
add
(
"作者"
);
title
.
add
(
"书刊类别"
);
title
.
add
(
"出版社"
);
title
.
add
(
"出版版次"
);
title
.
add
(
"剩余册数"
);
title
.
add
(
"所在书室"
);
title
.
add
(
"所在书架"
);
title
.
add
(
"图书编号"
);
//2.设置表格中的数据集合
Vector
<
Vector
>
data
=
new
Vector
<
Vector
>();
Vector
row
=
null
;
for
(
BookInfoBeans
b
:
list
)
{
row
=
new
Vector
<>();
row
.
add
(
b
.
getBookName
());
//书名
row
.
add
(
b
.
getAuthor
());
//作者
row
.
add
(
b
.
getBookClassify
());
//分类
row
.
add
(
b
.
getPublisher
());
//出版社
row
.
add
(
b
.
getPublishTime
());
//出版版次
row
.
add
(
b
.
getQuantity
());
//剩余册数
row
.
add
(
b
.
getStack
());
//所在书室
row
.
add
(
b
.
getBookShelf
());
//所在书架
row
.
add
(
b
.
getBookID
());
//图书编号
data
.
add
(
row
);
}
//设置tableModel
this
.
dtmView
=
new
DefaultTableModel
(
data
,
title
);
//将tableModel绑定在table上
this
.
tableDataView
.
setModel
(
dtmView
);
//设置表格自适应数据
tableDataView
.
FitTableColumns
();
if
(
p
==
0
)
{
jlbBook
.
setText
(
"暂未借阅书籍"
);
}
else
{
jlbBook
.
setText
(
"未归还书籍("
+
cp
+
"/"
+
p
+
")"
);
}
}
/**
* 更新读者信息
*
* @param cp 当前页数
* @param p 总页数
* @param beans 读者信息
*/
public
void
setReaderInfo
(
int
cp
,
int
p
,
ReaderInfoBeans
beans
)
{
//个人信息 6
cltReaderId
.
setIText
(
beans
.
getReaderID
());
//学号
cltReaderName
.
setIText
(
beans
.
getReaderName
());
//姓名
cltReaderApart
.
setIText
(
beans
.
getApart
());
//学院
cltReaderClass
.
setIText
(
beans
.
getTheClass
());
//班级
cltReaderTel
.
setIText
(
beans
.
getTelNo
());
//联系方式
if
(
"男"
.
equals
(
beans
.
getSex
()))
{
jcbSex
.
setSelectedIndex
(
1
);
}
else
if
(
"女"
.
equals
(
beans
.
getSex
()))
{
jcbSex
.
setSelectedIndex
(
2
);
}
jlbReader
.
setText
(
"读者搜索结果("
+
cp
+
"/"
+
p
+
")"
);
}
/**
* 重置数据
*/
public
void
resetData
()
{
// 借阅设置
jlbBook
.
setText
(
"已借阅书籍"
);
List
<
BookInfoBeans
>
beans
=
new
ArrayList
<>();
BookInfoBeans
infoBeans
=
new
BookInfoBeans
();
beans
.
add
(
infoBeans
);
setBookInfo
(
0
,
0
,
beans
);
//个人信息 6
cltReaderId
.
setIText
(
""
);
//学号
cltReaderName
.
setIText
(
""
);
//姓名
cltReaderApart
.
setIText
(
""
);
//学院
cltReaderClass
.
setIText
(
""
);
//班级
cltReaderTel
.
setIText
(
""
);
//班级
jcbSex
.
setSelectedIndex
(
0
);
jlbReader
.
setText
(
"读者信息"
);
}
public
JButton
getBtnSearchReader
()
{
return
btnSearchReader
;
}
...
...
@@ -409,10 +422,6 @@ public class BorrowInView extends JDialog {
return
cltBorrowDuration
;
}
public
ComboJLAndJT
getCltBorrowNumber
()
{
return
cltBorrowNumber
;
}
public
JTextField
getJtfReaderKeyword
()
{
return
jtfReaderKeyword
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录