⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 purchase.java

📁 java语言编写的基于sql2000开发的图书馆管理系统
💻 JAVA
字号:
package purchase;

import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Rectangle;
import java.awt.CardLayout;
import purchase.LackBook;
import purchase.Contract;
import main.PersonInfo;

public class Purchase extends JFrame {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JButton lackBook = null;

	private JButton contract = null;

	private JButton personInfo = null;

	private JButton about = null;
	static JFrame frame;
	
	///card用来初始化panel,panel的作用是包含缺书、合同等子模块
	private CardLayout card;
	private JPanel panel;
	

	/**
	 * This is the default constructor
	 */
	public Purchase() {
		super();		
		initialize();
		//System.out.println("hi");
		card =new CardLayout();
		panel=new JPanel(card);
		
		Purchase.frame=this;
		
		//增加相应的面板
		LackBook lackBook =new LackBook(this);
		panel.add(lackBook,"lackbook");
		Contract contract=new Contract();
		panel.add(contract,"contract");
		
		panel.setSize(500,280);
		panel.setLocation(30,60);
		//panel.setBackground(Color.RED);
		this.add(panel);
		this.setVisible(true);
		

		}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(566, 400);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setContentPane(getJContentPane());
		this.setTitle("采购员");
		this.setLocation(200,200);

	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getLackBook(), null);
			jContentPane.add(getContract(), null);
			jContentPane.add(getPersonInfo(), null);
			jContentPane.add(getAbout(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes lackBook	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLackBook() {
		if (lackBook == null) {
			lackBook = new JButton();
			lackBook.setBounds(new Rectangle(40, 16, 89, 29));
			lackBook.setText("查看缺书");
			lackBook.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
					Purchase.this.card.show(Purchase.this.panel,"lackbook");
					
				}
			});
		}
		return lackBook;
	}

	/**
	 * This method initializes contract	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getContract() {
		if (contract == null) {
			contract = new JButton();
			contract.setBounds(new Rectangle(169, 16, 92, 29));
			contract.setText("查看合同");
			contract.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					//System.out.println("actionPerformed()"); 
					Purchase.this.card.show(Purchase.this.panel,"contract");
				}
			});
		}
		return contract;
	}

	/**
	 * This method initializes personInfo	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPersonInfo() {
		if (personInfo == null) {
			personInfo = new JButton();
			personInfo.setBounds(new Rectangle(301, 16, 96, 29));
			personInfo.setText("个人信息");
			personInfo.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					new PersonInfo(Purchase.frame);
				}
			});
		}
		return personInfo;
	}

	/**
	 * This method initializes about	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getAbout() {
		if (about == null) {
			about = new JButton();
			about.setBounds(new Rectangle(437, 16, 80, 29));
			about.setText("关于");
			about.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					javax.swing.JOptionPane.showMessageDialog(null,"图书馆管理系统\n"+
							"北京航空航天大学计算机学院 \n"+
							"版本  1.0\n"+
							"开源  使用请说明出处\n");
				}
			});
		}
		return about;
	}
	
	

}  //  @jve:decl-index=0:visual-constraint="10,10"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -