📄 reception.java
字号:
package reception;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Rectangle;
import main.DataBase;
import main.PersonInfo;
import java.awt.CardLayout;
import java.awt.Color;
import reception.*;
import java.awt.Dimension;
public class Reception extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton search = null;
private JButton addMember = null;
private JButton dealFine = null;
private JButton personInfo = null;
private JButton about = null;
//frame 用来构造对话框
static JFrame frame;
///card用来初始化panel,panel的作用是包含缺书、合同等子模块
private CardLayout card;
private JPanel panel;
private JButton returnbook = null;
/**
* This is the default constructor
*/
public Reception() {
super();
initialize();
card =new CardLayout();
panel=new JPanel(card);
Reception.frame=this;
//增加相应的面板
//查找,借阅书籍
SearchBook search=new SearchBook();
//search.setBackground(Color.BLACK);
panel.add(search, "search");
//增加会员
AddMember addmember=new AddMember();
panel.add(addmember,"addmember");
//还书
ReturnBook returnBook=new ReturnBook();
panel.add(returnBook,"returnbook");
//处理罚单
DealWithFine deal=new DealWithFine();
panel.add(deal,"deal");
panel.setSize(580, 400);
//panel.setBackground(Color.black);
panel.setLocation(20,60);
this.add(panel);
this.setVisible(true);
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(624, 488);
this.setContentPane(getJContentPane());
this.setTitle("借阅台");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getSearch(), null);
jContentPane.add(getAddMember(), null);
jContentPane.add(getDealFine(), null);
jContentPane.add(getPersonInfo(), null);
jContentPane.add(getAbout(), null);
jContentPane.add(getReturnbook(), null);
}
return jContentPane;
}
/**
* This method initializes search
*
* @return javax.swing.JButton
*/
private JButton getSearch() {
if (search == null) {
search = new JButton();
search.setBounds(new Rectangle(9, 3, 104, 21));
search.setText("查找书籍");
search.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reception.this.card.show(Reception.this.panel, "search");
}
});
}
return search;
}
/**
* This method initializes addMember
*
* @return javax.swing.JButton
*/
private JButton getAddMember() {
if (addMember == null) {
addMember = new JButton();
addMember.setBounds(new Rectangle(225, 4, 96, 21));
addMember.setText("添加会员");
addMember.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
Reception.this.card.show(Reception.this.panel,"addmember");
}
});
}
return addMember;
}
/**
* This method initializes dealFine
*
* @return javax.swing.JButton
*/
private JButton getDealFine() {
if (dealFine == null) {
dealFine = new JButton();
dealFine.setBounds(new Rectangle(339, 3, 87, 21));
dealFine.setText("处理罚单");
dealFine.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//处理罚单
Reception.this.card.show(Reception.this.panel,"deal");
}
});
}
return dealFine;
}
/**
* This method initializes personInfo
*
* @return javax.swing.JButton
*/
private JButton getPersonInfo() {
if (personInfo == null) {
personInfo = new JButton();
personInfo.setBounds(new Rectangle(437, 3, 88, 21));
personInfo.setText("个人信息");
personInfo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
new main.PersonInfo(Reception.frame);
}
});
}
return personInfo;
}
/**
* This method initializes about
*
* @return javax.swing.JButton
*/
private JButton getAbout() {
if (about == null) {
about = new JButton();
about.setBounds(new Rectangle(536, 3, 63, 21));
about.setText("关于");
about.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
javax.swing.JOptionPane.showMessageDialog(null,"图书馆管理系统\n"+
"北京航空航天大学计算机学院 \n"+
"版本 1.0\n"+
"开源 使用请说明出处\n");
}
});
}
return about;
}
/**
* This method initializes returnbook
*
* @return javax.swing.JButton
*/
private JButton getReturnbook() {
if (returnbook == null) {
returnbook = new JButton();
returnbook.setBounds(new Rectangle(117, 3, 101, 21));
returnbook.setText("还书");
returnbook.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
Reception.this.card.show(Reception.this.panel,"returnbook");
}
});
}
return returnbook;
}
} // @jve:decl-index=0:visual-constraint="10,10"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -