?? 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 + -