基于Java swing+mysql的图书管理系统

*****************************************************

基于Java swing+mysql的图书管理系统

系统主要有四个模块:基础数据维护(图书类型、图书信息的维护),新书订购管理(新书的预定、验收),借阅管理(读者管理、借书订单维护等),系统维护(管理员信息维护,密码修改等)。

话不多说直接上图(源码在最后):

1.登录界面,用户名:whj 密码:123

登录界面

package com.wsy.iframe;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.wsy.Library;
import com.wsy.dao.Dao;
import com.wsy.model.Operater;
import com.wsy.util.CreatecdIcon;
import com.wsy.util.MyDocument;

public class BookLoginIFrame extends JFrame {

	private class BookResetAction implements ActionListener {
		public void actionPerformed(final ActionEvent e){
			username.setText("");
			password.setText("");
			
		}
	}
	class BookLoginAction implements ActionListener {
		public void actionPerformed(final ActionEvent e) {
			user = Dao.check(username.getText(), password.getText());
			if (user.getName() != null) {

				try {

					Library frame = new Library();
					frame.setVisible(true);
					BookLoginIFrame.this.setVisible(false);
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			} else {
				JOptionPane.showMessageDialog(null, "只有管理员才可以登录!");
				username.setText("");
				password.setText("");
			}
		}
	}
	private JPasswordField password;
	private JTextField username;
	private JButton login;
	private JButton reset;
	private static Operater user;
	/**
	 * Launch the application
	 * @param args
	 */

	/**
	 * Create the frame
	 */
	public BookLoginIFrame() {
		super();
		final BorderLayout borderLayout = new BorderLayout();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		borderLayout.setVgap(10);
		getContentPane().setLayout(borderLayout);
		setTitle("图书馆管理系统登录");
		setBounds(100, 100, 285, 194);

		final JPanel panel = new JPanel();
		panel.setLayout(new BorderLayout());
		panel.setBorder(new EmptyBorder(0, 0, 0, 0));
		getContentPane().add(panel);

		final JPanel panel_2 = new JPanel();
		final GridLayout gridLayout = new GridLayout(0, 2);
		gridLayout.setHgap(5);
		gridLayout.setVgap(20);
		panel_2.setLayout(gridLayout);
		panel.add(panel_2);

		final JLabel label = new JLabel();
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setPreferredSize(new Dimension(0, 0));
		label.setMinimumSize(new Dimension(0, 0));
		panel_2.add(label);
		label.setText("用  户  名:");

		username = new JTextField(20);
		username.setPreferredSize(new Dimension(0, 0));
		panel_2.add(username);

		final JLabel label_1 = new JLabel();
		label_1.setHorizontalAlignment(SwingConstants.CENTER);
		panel_2.add(label_1);
		label_1.setText("密      码:");

		password = new JPasswordField(20);
		password.setDocument(new MyDocument(6));
		password.setEchoChar('*');//设置密码框的回显字符
		password.addKeyListener(new KeyAdapter() {
			public void keyPressed(final KeyEvent e) {
				if (e.getKeyCode() == 10)
					login.doClick();
			}
		});
		panel_2.add(password);

		final JPanel panel_1 = new JPanel();
		panel.add(panel_1, BorderLayout.SOUTH);

		login=new JButton();
		login.addActionListener(new BookLoginAction());
		
		
		login.setText("登录");
		panel_1.add(login);
		reset=new JButton();
		reset.addActionListener(new BookResetAction());
		
		reset.setText("重置");
		panel_1.add(reset);

		final JLabel tupianLabel = new JLabel();
		ImageIcon loginIcon=CreatecdIcon.add("login.jpg");
		tupianLabel.setIcon(loginIcon);
		tupianLabel.setOpaque(true);
		tupianLabel.setBackground(Color.GREEN);
		tupianLabel.setPreferredSize(new Dimension(260, 60));
		panel.add(tupianLabel, BorderLayout.NORTH);
		//
		setVisible(true);
		setResizable(false);
		//setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

	}
	public static Operater getUser() {
		return user;
	}
	public static void setUser(Operater user) {
		BookLoginIFrame.user = user;
	}

}

2.基础数据管理页面

在这里插入图片描述

3.基础信息管理页面

在这里插入图片描述

package com.wsy;

import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JInternalFrame;

import com.wsy.iframe.BookAddIFrame;
import com.wsy.iframe.BookBackIFrame;
import com.wsy.iframe.BookBorrowIFrame;
import com.wsy.iframe.BookModiAndDelIFrame;
import com.wsy.iframe.BookSearchIFrame;
import com.wsy.iframe.BookTypeAddIFrame;
import com.wsy.iframe.BookTypeModiAndDelIFrame;
import com.wsy.iframe.GengGaiMiMa;
import com.wsy.iframe.ReaderAddIFrame;
import com.wsy.iframe.ReaderModiAndDelIFrame;
import com.wsy.iframe.UserAddIFrame;
import com.wsy.iframe.UserModiAndDelIFrame;
import com.wsy.iframe.newBookCheckIFrame;
import com.wsy.iframe.newBookOrderIFrame;
import com.wsy.util.*;
/**
 * 菜单和按钮的Action对象
 * 
 */
public class MenuActions {
	private static Map<String, JInternalFrame> frames; // 子窗体集合

	public static PasswordModiAction MODIFY_PASSWORD; // 修改密码窗体动作
	public static UserModiAction USER_MODIFY; // 修改用户资料窗体动作
	public static UserAddAction USER_ADD; // 用户添加窗体动作
	public static BookSearchAction BOOK_SEARCH; // 图书搜索窗体动作
	public static GiveBackAction GIVE_BACK; // 图书归还窗体动作
	public static BorrowAction BORROW; // 图书借阅窗体动作
	public static CheckAndAcceptNewBookAction NEWBOOK_CHECK_ACCEPT;// 修改密码动作
	public static BoodOrderAction NEWBOOK_ORDER; // 新书定购窗体动作
	public static BookTypeModiAction BOOKTYPE_MODIFY; // 图书类型修改窗体动作
	public static BookTypeAddAction BOOKTYPE_ADD; // 图书类型添加窗体动作
	public static ReaderModiAction READER_MODIFY; // 读者信息修改窗体动作
	public static ReaderAddAction READER_ADD; // 读者信息添加窗体动作
	public static BookModiAction BOOK_MODIFY; // 图书信息修改窗体动作
	public static BookAddAction BOOK_ADD; // 图书信息添加窗体动作
	public static ExitAction EXIT; // 系统退出动作

	static {
		frames = new HashMap<String, JInternalFrame>();

		MODIFY_PASSWORD = new PasswordModiAction();
		USER_MODIFY = new UserModiAction();
		USER_ADD = new UserAddAction();
		BOOK_SEARCH = new BookSearchAction();
		GIVE_BACK = new GiveBackAction();
		BORROW = new BorrowAction();
		NEWBOOK_CHECK_ACCEPT = new CheckAndAcceptNewBookAction();
		NEWBOOK_ORDER = new BoodOrderAction();
		BOOKTYPE_MODIFY = new BookTypeModiAction();
		BOOKTYPE_ADD = new BookTypeAddAction();
		READER_MODIFY = new ReaderModiAction();
		READER_ADD = new ReaderAddAction();
		BOOK_MODIFY = new BookModiAction();
		BOOK_ADD = new BookAddAction();
		EXIT = new ExitAction();
	}

	private static class PasswordModiAction extends AbstractAction {
		PasswordModiAction() {
			putValue(Action.NAME,"更改口令");
			putValue(Action.LONG_DESCRIPTION, "修改当前用户密码");
			putValue(Action.SHORT_DESCRIPTION, "更换口令");//在“更改口令”提示中显示的文字
			//putValue(Action.SMALL_ICON,CreatecdIcon.add("bookAddtb.jpg"));
			//将图标存储到动作对象中
			//setEnabled(false);//使动作禁用
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("更改密码")||frames.get("更改密码").isClosed()) {
				GengGaiMiMa iframe=new GengGaiMiMa();
				frames.put("更改密码", iframe);
				Library.addIFame(frames.get("更改密码"));
			}
		}
	}

	private static class UserModiAction extends AbstractAction {
		UserModiAction() {
			super("用户修改与删除", null);
			putValue(Action.LONG_DESCRIPTION, "修改和删除用户信息");
			putValue(Action.SHORT_DESCRIPTION, "用户修改与删除");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("用户信息修改与删除")||frames.get("用户信息修改与删除").isClosed()) {
				UserModiAndDelIFrame iframe=new UserModiAndDelIFrame();
				frames.put("用户信息修改与删除", iframe);
				Library.addIFame(frames.get("用户信息修改与删除"));
			}
		}
	}

	private static class UserAddAction extends AbstractAction {
		UserAddAction() {
			super("用户添加", null);
			putValue(Action.LONG_DESCRIPTION, "添加新的用户");
			putValue(Action.SHORT_DESCRIPTION, "用户添加");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("用户信息添加")||frames.get("用户信息添加").isClosed()) {
				UserAddIFrame iframe=new UserAddIFrame();
				frames.put("用户信息添加", iframe);
				Library.addIFame(frames.get("用户信息添加"));
			}
			
		}
	}

	private static class BookSearchAction extends AbstractAction {
		BookSearchAction() {
			super("图书搜索", null);
			putValue(Action.LONG_DESCRIPTION, "搜索入库的图书信息");
			putValue(Action.SHORT_DESCRIPTION, "图书搜索");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书查询")||frames.get("图书查询").isClosed()) {
				BookSearchIFrame iframe=new BookSearchIFrame();
				frames.put("图书查询", iframe);
				Library.addIFame(frames.get("图书查询"));
			}
		}
	}

	private static class GiveBackAction extends AbstractAction {
		GiveBackAction() {
			super("图书归还", null);
			putValue(Action.LONG_DESCRIPTION, "归还借阅的图书");
			putValue(Action.SHORT_DESCRIPTION, "图书归还");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书归还管理")||frames.get("图书归还管理").isClosed()) {
				BookBackIFrame iframe=new BookBackIFrame();
				frames.put("图书归还管理", iframe);
				Library.addIFame(frames.get("图书归还管理"));
			}
		}
	}

	private static class BorrowAction extends AbstractAction {
		BorrowAction() {
			super("图书借阅", null);
			putValue(Action.LONG_DESCRIPTION, "从图书馆借阅图书");
			putValue(Action.SHORT_DESCRIPTION, "图书借阅");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书借阅管理")||frames.get("图书借阅管理").isClosed()) {
				BookBorrowIFrame iframe=new BookBorrowIFrame();
				frames.put("图书借阅管理", iframe);
				Library.addIFame(frames.get("图书借阅管理"));
			}
		}
	}

	private static class CheckAndAcceptNewBookAction extends AbstractAction {
		CheckAndAcceptNewBookAction() {
			super("验收新书", null);
			putValue(Action.LONG_DESCRIPTION, "验收订阅的新图书");
			putValue(Action.SHORT_DESCRIPTION, "验收新书");
		}
		public void actionPerformed(ActionEvent e) {
			
			if (!frames.containsKey("图书验收")||frames.get("图书验收").isClosed()) {
				newBookCheckIFrame iframe=new newBookCheckIFrame();
				frames.put("图书验收", iframe);
				Library.addIFame(frames.get("图书验收"));
			}
		}
	}

	private static class BoodOrderAction extends AbstractAction {
		BoodOrderAction() {
			super("新书定购", null);
			putValue(Action.LONG_DESCRIPTION, "定购新的图书");
			putValue(Action.SHORT_DESCRIPTION, "新书定购");
		}
		public void actionPerformed(ActionEvent e) {
			
			if (!frames.containsKey("新书订购管理")||frames.get("新书订购管理").isClosed()) {
				newBookOrderIFrame iframe=new newBookOrderIFrame();
				frames.put("新书订购管理", iframe);
				Library.addIFame(frames.get("新书订购管理"));
			}
		}
	}

	private static class BookTypeModiAction extends AbstractAction {
		BookTypeModiAction() {
			super("图书类别修改", null);
			putValue(Action.LONG_DESCRIPTION, "修改图书的类别信息");
			putValue(Action.SHORT_DESCRIPTION, "图书类别修改");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书类别修改")||frames.get("图书类别修改").isClosed()) {
				BookTypeModiAndDelIFrame iframe=new BookTypeModiAndDelIFrame();
				frames.put("图书类别修改", iframe);
				Library.addIFame(frames.get("图书类别修改"));
			}
		}
	}

	private static class BookTypeAddAction extends AbstractAction {
		BookTypeAddAction() {
			super("图书类别添加", null);
			putValue(Action.LONG_DESCRIPTION, "为图书馆添加新的图书类别");
			putValue(Action.SHORT_DESCRIPTION, "图书类别添加");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书类别添加")||frames.get("图书类别添加").isClosed()) {
				BookTypeAddIFrame iframe=new BookTypeAddIFrame();
				frames.put("图书类别添加", iframe);
				Library.addIFame(frames.get("图书类别添加"));
			}
		}
	}
	private static class ReaderModiAction extends AbstractAction {
		ReaderModiAction() {
			super("读者修改与删除", null);
			putValue(Action.LONG_DESCRIPTION, "修改和删除读者的基本信息");
			putValue(Action.SHORT_DESCRIPTION, "读者修改与删除");
		}
		public void actionPerformed(ActionEvent e) {
			
			if (!frames.containsKey("读者信息修改与删除")||frames.get("读者信息修改与删除").isClosed()) {
				ReaderModiAndDelIFrame iframe=new ReaderModiAndDelIFrame();
				frames.put("读者信息修改与删除", iframe);
				Library.addIFame(frames.get("读者信息修改与删除"));
			}
		}
	}

	private static class ReaderAddAction extends AbstractAction {
		ReaderAddAction() {
			super("读者信息添加", null);
			putValue(Action.LONG_DESCRIPTION, "为图书馆添加新的读者会员信息");
			putValue(Action.SHORT_DESCRIPTION, "读者信息添加");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("读者相关信息添加")||frames.get("读者相关信息添加").isClosed()) {
				ReaderAddIFrame iframe=new ReaderAddIFrame();
				frames.put("读者相关信息添加", iframe);
				Library.addIFame(frames.get("读者相关信息添加"));
			}
		}
	}
	//图书修改与删除
	private static class BookModiAction extends AbstractAction {
		BookModiAction() {
			super("图书修改", null);
			putValue(Action.LONG_DESCRIPTION, "修改和删除图书信息");
			putValue(Action.SHORT_DESCRIPTION, "图书修改");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书修改")||frames.get("图书修改").isClosed()) {
				BookModiAndDelIFrame iframe=new BookModiAndDelIFrame();
				frames.put("图书修改", iframe);
				Library.addIFame(frames.get("图书修改"));
			}
		}
	}
	private static class BookAddAction extends AbstractAction {				// 图书信息添加---已经实现,请参照
		BookAddAction() {

			super("图书信息添加", null);
			//super();
			putValue(Action.LONG_DESCRIPTION, "为图书馆添加新的图书信息");
			putValue(Action.SHORT_DESCRIPTION, "图书信息添加");
		}
		public void actionPerformed(ActionEvent e) {
			if (!frames.containsKey("图书信息添加")||frames.get("图书信息添加").isClosed()) {
				BookAddIFrame iframe = new BookAddIFrame();
				frames.put("图书信息添加", iframe);
				Library.addIFame(frames.get("图书信息添加"));
			}
		}
	}
	private static class ExitAction extends AbstractAction { // 退出系统动作
		public ExitAction() {
			super("退出系统", null);
			putValue(Action.LONG_DESCRIPTION, "退出图书馆管理系统");
			putValue(Action.SHORT_DESCRIPTION, "退出系统");
		}
		public void actionPerformed(final ActionEvent e) {
			System.exit(0);
		}
	}

	private MenuActions() {
		super();
	}

}

4.新书订购管理页面

在这里插入图片描述

5.图书借阅管理页面

在这里插入图片描述

package com.wsy.iframe;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;

import com.wsy.JComPz.MapPz;
import com.wsy.dao.Dao;
import com.wsy.model.Operater;
import com.wsy.model.OrderAndBookInfo;

public class newBookCheckIFrame extends JInternalFrame {

	private JTextField bookType;
	private JTextField orderPrice;
	private JTextField zk;
	private JTable table;
	private ButtonGroup buttonGroup = new ButtonGroup();
	private JTextField price;
	private JTextField operator;
	private JTextField orderNumber;
	private JTextField ISBN;
	private JFormattedTextField orderDate;
	private Operater user = BookLoginIFrame.getUser(); 
	
	JRadioButton radioButton2;
	JRadioButton radioButton1;
	private String[] columnNames={ "图书编号", "订购日期", "订购数量","操作员","是否验收","折扣","图书类别","图书名称","作者","译者","出版社","出版日期","图书价格"};
	private Map map=MapPz.getMap();
	private Object[][] getFileStates(List list){
		Object[][]results=new Object[list.size()][columnNames.length];
		for(int i=0;i<list.size();i++){
			OrderAndBookInfo order=(OrderAndBookInfo)list.get(i);
			results[i][0]=order.getISBN();
			results[i][1]=order.getOrderdate();
			results[i][2]=order.getNumber();
			results[i][3]=order.getOperator();
			
			String CheckAndAccepts;
			if(order.getCheckAndAccept().equals("1"))//1代表没有验收
				CheckAndAccepts="否";
			else
				CheckAndAccepts="是";
			results[i][4]=CheckAndAccepts;
			
			results[i][5]=order.getZk();
			
			String bookTypes=String.valueOf(MapPz.getMap().get(order.getTypeId()));
			results[i][6]=bookTypes;
			
			results[i][7]=order.getBookname();
			results[i][8]=order.getWriter();
			results[i][9]=order.getTraslator();
			results[i][10]=order.getPublisher();
			results[i][11]=order.getDate();
			results[i][12]=order.getPrice();
		}
		return results;
	         		
	}

	/**
	 * Create the frame
	 */
	public newBookCheckIFrame() {
		super();
		setClosable(true);
		setIconifiable(true);
		setAutoscrolls(true);
		setTitle("图书验收");
		setBounds(100, 100, 700, 420);
		

		final JPanel panel = new JPanel();
		getContentPane().add(panel);

		final JScrollPane scrollPane = new JScrollPane();
		scrollPane.setPreferredSize(new Dimension(680, 180));
		panel.add(scrollPane);

		final DefaultTableModel model=new DefaultTableModel();
		Object[][] results=getFileStates(Dao.selectBookOrder());
		model.setDataVector(results,columnNames);
		table = new JTable();
		table.setModel(model);
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);//关闭列自动变小
		scrollPane.setViewportView(table);
		table.addMouseListener(new TableListener());



		final JPanel panel_1_1 = new JPanel();
		final GridLayout gridLayout = new GridLayout(0, 4);
		gridLayout.setVgap(5);
		panel_1_1.setLayout(gridLayout);
		panel_1_1.setPreferredSize(new Dimension(450, 150));
		panel.add(panel_1_1);

		final JLabel label_1 = new JLabel();
		label_1.setText("订购日期:");
		panel_1_1.add(label_1);

		SimpleDateFormat myfmt=new SimpleDateFormat("yyyy-MM-dd");

		orderDate = new JFormattedTextField(myfmt.getDateInstance());
		orderDate.setValue(new java.util.Date());
		orderDate.addKeyListener(new DateListener());

		panel_1_1.add(orderDate);

		final JLabel label_3 = new JLabel();
		label_3.setText("书籍编号:");
		panel_1_1.add(label_3);

		ISBN = new JTextField();
		panel_1_1.add(ISBN);

		final JLabel label_4 = new JLabel();
		label_4.setText("订购数量:");
		panel_1_1.add(label_4);

		orderNumber = new JTextField();
		panel_1_1.add(orderNumber);

		final JLabel label_5 = new JLabel();
		label_5.setText("操作员:");
		panel_1_1.add(label_5);
		operator = new JTextField(user.getName());
		panel_1_1.add(operator);

		final JLabel label_6 = new JLabel();
		label_6.setText("图书类别:");
		panel_1_1.add(label_6);

		bookType = new JTextField();
		panel_1_1.add(bookType);


		final JLabel label_7 = new JLabel();
		label_7.setText("图书原价格:");
		panel_1_1.add(label_7);

		price = new JTextField();
		panel_1_1.add(price);

		final JLabel label_9 = new JLabel();
		label_9.setText("是否验收:");
		panel_1_1.add(label_9);

		final JPanel panel_1 = new JPanel();
		panel_1_1.add(panel_1);

		radioButton1 = new JRadioButton();
		radioButton1.setSelected(true);
		panel_1.add(radioButton1);
		buttonGroup.add(radioButton1);
		radioButton1.setText("是");

		radioButton2= new JRadioButton();
		panel_1.add(radioButton2);
		buttonGroup.add(radioButton2);
		radioButton2.setText("否");

		final JLabel label = new JLabel();
		label.setText("折扣:");
		panel_1_1.add(label);

		zk = new JTextField();
		panel_1_1.add(zk);

		final JLabel label_2 = new JLabel();
		label_2.setText("订购价格:");
		panel_1_1.add(label_2);

		orderPrice = new JTextField();
		panel_1_1.add(orderPrice);
		setVisible(true);

		final JPanel panel_2 = new JPanel();
		getContentPane().add(panel_2, BorderLayout.SOUTH);

		final JButton buttonCheck = new JButton();
		panel_2.add(buttonCheck);
		buttonCheck.setText("验收");
		buttonCheck.addActionListener(new CheckActionListener(model));

		final JButton buttonExit = new JButton();
		panel_2.add(buttonExit);
		buttonExit.addActionListener(new CloseActionListener());
		buttonExit.setText("退出");
		
		//
	}
	class DateListener extends KeyAdapter {
		public void keyTyped(KeyEvent e) {
			if(orderDate.getText().isEmpty()){
				JOptionPane.showMessageDialog(null, "时间格式请使用\"2007-05-10\"格式");
			}
		}
	}
	class TableListener extends MouseAdapter {
		public void mouseClicked(final MouseEvent e) {
			
			int selRow = table.getSelectedRow();
			ISBN.setText(table.getValueAt(selRow, 0).toString().trim());
			orderDate.setText(table.getValueAt(selRow, 1).toString().trim());
			
			orderNumber.setText(table.getValueAt(selRow, 2).toString().trim());
			operator.setText(table.getValueAt(selRow, 3).toString().trim());
			
			bookType.setText(table.getValueAt(selRow, 6).toString().trim());
			
			price.setText(table.getValueAt(selRow, 12).toString().trim());
			if(table.getValueAt(selRow, 4).toString().trim().equals("否"))//1代表没有验收
				radioButton2.setSelected(true);
			else
				radioButton1.setSelected(true);
			zk.setText(table.getValueAt(selRow, 5).toString().trim());
			orderPrice.setText(Double.valueOf(table.getValueAt(selRow, 12).toString().trim())*Double.valueOf(table.getValueAt(selRow, 5).toString().trim())+"");
			
		}
	}
	class CloseActionListener implements ActionListener {			// 添加关闭按钮的事件监听器
		public void actionPerformed(final ActionEvent e) {
			doDefaultCloseAction();
		}
	}
	class CheckActionListener implements ActionListener{
		private final DefaultTableModel model;

		CheckActionListener(DefaultTableModel model) {
			this.model = model;
		}
		public void actionPerformed(final ActionEvent e) {
			if(radioButton2.isSelected()){
				String ISBNs=ISBN.getText();
				int i=Dao.UpdateCheckBookOrder(ISBNs);
				if(i==1){
					JOptionPane.showMessageDialog(null, "验收成功!");
					Object[][] results=getFileStates(Dao.selectBookOrder());
					model.setDataVector(results,columnNames);
					table.setModel(model);
					radioButton1.setSelected(true);
				}
			}
			else {
				JOptionPane.showMessageDialog(null, "您选择的图书已经进行过验收,请选择其他图书进行验收");
			}
			
			
			
			
		}
	}
}

6.系统维护页面

在这里插入图片描述

源码链接

链接: https://download.csdn.net/download/qq_39556704/12530905.

Alt

Java语言是一种面向对象的编程语言,拥有良好的跨平台性,同时也是当今最流行的编程语言之一。SwingJava提供的GUI工具包,可以用于创建各种图形用户界面。MySQL是一种现代的关系型数据库管理系统,免费开源,具有高可靠性、高性能、高安全性等特点。图书管理系统是一种常见的信息管理系统,可以用来处理图书借阅、归还、入库、出库等相关业务。 因此,Java Swing MySQL图书管理系统是一个基于Java语言和Swing图形界面技术开发的图书管理系统,它通过与MySQL数据库进行集成,可以实现图书信息的录入、管理、查询和统计等多种功能。系统的主要模块包括读者管理、图书管理、借阅管理、统计分析等。其中读者管理包括读者信息的录入、查找、修改和删除等操作;图书管理包括图书的入库、出库、查询、修改和删除等操作;借阅管理包括读者的借阅、归还、续借等操作;统计分析则包括对图书数据的分析、统计和报表输出。 利用Java Swing MySQL图书管理系统,管理员可以方便地管理图书信息和读者信息,实现自动化借阅和归还,减轻了管理员的工作负担,同时也保证了图书流通的顺畅性。此外,系统还可以为读者提供自助借还书和在线查询等功能,提升了图书馆的服务质量和用户体验。总之,Java Swing MySQL图书管理系统是一个强大而实用的工具,为图书馆的管理工作提供了可靠的支持。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值