Demo entry 6646690

zsjxilinjie

   

Submitted by anonymous on Oct 17, 2017 at 17:43
Language: Java. Code size: 2.6 kB.

package library;

import java.util.Iterator;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class Library {

	JFrame frame = new JFrame("图书馆");
	Container contentPane = frame.getContentPane();
	
	public static void main(String[] args) {
		Library library = new Library();
		library.go();
//		BorrowRecord b1 = new BorrowRecord("account1","book1","1998");
//		BorrowRecord b2 = new BorrowRecord("account1","book2","1998");
//		BorrowRecord b3 = new BorrowRecord("account3","book","1998");
//		BorrowRecord b4 = new BorrowRecord("account4","book","1998");
//		BorrowRecord b5 = new BorrowRecord("account5","book","1998");
//		BorrowRecord b6 = new BorrowRecord("account6","book","1998");
//		
//		BorrowRecord borrowRecord;
//		//打印全部借书记录
//		for(Iterator<BorrowRecord> it = BorrowRecord.allBorrowRecords.iterator(); it.hasNext();) {
//			borrowRecord = it.next();
//			System.out.println(borrowRecord);
//		}
//		System.out.println();
//		
//		ReturnRecord r1 = new ReturnRecord("account1","book2","1998");
//		
//		//打印全部借书记录
//		for(Iterator<BorrowRecord> it = BorrowRecord.allBorrowRecords.iterator(); it.hasNext();) {
//			borrowRecord = it.next();
//			System.out.println(borrowRecord);
//		}
	}//main
	
	public void go() {
//创建菜单栏
		JMenuBar menubar = new JMenuBar();
		frame.setJMenuBar(menubar);
		
		JMenu menu;
		JMenuItem menuitem;
		
		
		//加入录入菜单
		menu = new JMenu("录入");
		menubar.add(menu);
		
		menuitem = new JMenuItem("用户信息");
		menu.add(menuitem);
		menuitem = new JMenuItem("图书信息");
		menu.add(menuitem);
		menu.add(new JSeparator());
		menuitem = new JMenuItem("借书记录");
		menu.add(menuitem);
		menuitem = new JMenuItem("还书记录");
		menu.add(menuitem);
		
		//加入用户菜单
		menu = new JMenu("用户");
		menubar.add(menu);
		menuitem = new JMenuItem("登陆");
		menu.add(menuitem);
		menuitem = new JMenuItem("退出");
//		menu.add(menuitem);		
//		//若点击“退出”
//		menuitem.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				System.exit(0);
//			}
//		});
		
//制作登陆界面
		JLabel loginLable = new JLabel("登陆图书馆");
		JLabel accountLabel = new JLabel("账号");
		JLabel passwordLabel = new JLabel("密码");
		JLabel confirm = new JLabel("确认");
		
		JTextField accountField = new JTextField();
		JPasswordField passwordField = new JPasswordField();
		
		confirm.addActionListen		
		
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(600, 600);
		frame.setVisible(true);
	}

}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).