基于java+mysql的swing+mysql图书管理系统(java+swing+gui+mysql)

基于java+mysql的swing+mysql图书管理系统(java+swing+gui+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于java+mysql的Swing+MySQL图书管理系统(java+swing+gui+mysql)

功能介绍:借阅列表、图书类别管理、图书馆里、用户管理、借阅管理、关于我们

	 */
	public UserMainFrm(User user) {

		setTitle("\u501F\u9605\u7CFB\u7EDF");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 835, 445);
		this.user = user;
		JOptionPane.showMessageDialog(null, "欢迎" + user.getPname() + "使用我们的系统");

		init();
		fillTable(new Book());
		this.fillBookType("search");
		this.fillBookType("modify");
	}

	// 填充下拉菜单
	private void fillBookType(String type) {
		Connection con = null;
		BookType bookType = null;
		try {
			con = dbUtil.getCon();
			ResultSet rs = bookTypeDao.bookTypeList(con, new BookType());
			if ("search".equals(type)) {
				bookType = new BookType();
				bookType.setBookTypeName("请选择...");
				bookType.setId(-1);
				this.jcb_bookType.addItem(bookType);
			}
			while (rs.next()) {
				bookType = new BookType();
				bookType.setId(rs.getInt("id"));
				bookType.setBookTypeName(rs.getString("bookTypeName"));
				if ("search".equals(type)) {
					this.jcb_bookType.addItem(bookType);
				} else if ("modify".equals(type)) {
					this.jcb_bookType.addItem(bookType);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
	 */
	public BookTypeAddInterFrm() {
		setIconifiable(true);
		setClosable(true);
		setResizable(true);
		setTitle("\u6DFB\u52A0\u56FE\u4E66\u7C7B\u522B");
		setBounds(100, 100, 480, 325);
		setLocation(500, 100);
		getContentPane().setLayout(null);
		init();

	}

	private void init() {
		BookTypeDao bookTypeDao = new BookTypeDao();
		DbUtil dbUtil = new DbUtil();
		JLabel lb_BookTypeName = new JLabel(
				"\u56FE\u4E66\u7C7B\u522B\u540D\u79F0\uFF1A");
		lb_BookTypeName.setBounds(53, 32, 99, 15);
		getContentPane().add(lb_BookTypeName);

		bookTypeNameTxt = new JTextField();
		bookTypeNameTxt.setBounds(162, 29, 150, 21);
		getContentPane().add(bookTypeNameTxt);
		bookTypeNameTxt.setColumns(10);

		JLabel lblNewLabel_1 = new JLabel(
				"\u56FE\u4E66\u7C7B\u522B\u63CF\u8FF0\uFF1A");
		lblNewLabel_1.setBounds(53, 91, 99, 15);
		getContentPane().add(lblNewLabel_1);

		bookTypeDescTxt = new JTextArea();
		bookTypeDescTxt.setBounds(162, 87, 200, 121);
		getContentPane().add(bookTypeDescTxt);
		// 添加图书类别按钮
		JButton jb_bookTypeAdd = new JButton("\u6DFB\u52A0");
		jb_bookTypeAdd.setIcon(new ImageIcon(
				"D:\\java\\MyBookManager\\image\\add.png"));
		jb_bookTypeAdd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String bookTypeName = bookTypeNameTxt.getText();
				String bookTypeDesc = bookTypeDescTxt.getText();
				if (StringUtil.isEmpty(bookTypeName)) {
					JOptionPane.showMessageDialog(null, "图书类别名称不能为空");
				} else {
					Connection con = null;

					try {
						con = dbUtil.getCon();
						BookType bookType = new BookType(bookTypeName,
								bookTypeDesc);
						int ret = bookTypeDao.bookTypeAdd(con, bookType);
						if (1 == ret) {
				e.printStackTrace();
			}
		}
	}

	// 填充表格
	private void fillTable(Book book) {
		DefaultTableModel dtm = (DefaultTableModel) table.getModel();
		dtm.setRowCount(0);
		Connection con = null;
		try {
			con = dbUtil.getCon();
			ResultSet rs = bookDao.bookList(con, book);
			while (rs.next()) {
				Vector v = new Vector();
				v.add(rs.getInt("id"));
				v.add(rs.getString("bookName"));
				v.add(rs.getString("author"));
				v.add(rs.getFloat("price"));
				v.add(rs.getString("bookDesc"));
				v.add(rs.getString("bookTypeName"));
				String state = rs.getInt("state") == 1 ? "借阅中" : "正常";
				v.add(state);
				dtm.addRow(v);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	private void init() {
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		panel = new JPanel();
		panel.setLayout(null);
		panel.setToolTipText("\u641C\u7D22\u6761\u4EF6");
		panel.setBorder(new TitledBorder(null, "\u641C\u7D22\u6761\u4EF6",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel.setBounds(43, 28, 732, 68);
		contentPane.add(panel);

		JLabel label = new JLabel("\u56FE\u4E66\u7C7B\u522B\uFF1A\r\n");
		label.setBounds(410, 29, 72, 15);
		panel.add(label);
			return null;
	}

}
/*******************************************************************************
 * Copyright (c) 2011 Google, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Google, Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.wb.swing;

/**
 * Cyclic focus traversal policy based on array of components.
 * <p>
 * This class may be freely distributed as part of any application or plugin.
 * 
 */
public class FocusTraversalOnArray extends FocusTraversalPolicy {
	private final Component m_Components[];

	// //
	//
	// Constructor
	//
	// //
	public FocusTraversalOnArray(Component components[]) {
		m_Components = components;
	}

	// //
	//
	// Utilities
	//
	// //
	private int indexCycle(int index, int delta) {
		int size = m_Components.length;
		int next = (index + delta + size) % size;
		return next;
	}

	private Component cycle(Component currentComponent, int delta) {
			ResultSet rs = bookDao.bookList(con, book);
			while (rs.next()) {
				Vector v = new Vector();
				v.add(rs.getInt("id"));
				v.add(rs.getString("bookName"));
				v.add(rs.getString("author"));
				v.add(rs.getFloat("price"));
				v.add(rs.getString("bookDesc"));
				v.add(rs.getString("bookTypeName"));
				dtm.addRow(v);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	private void init() {
		scrollPane = new JScrollPane();
		scrollPane.setToolTipText("");
		scrollPane.setBounds(30, 91, 732, 178);
		getContentPane().add(scrollPane);

		bookTable = new JTable();
		bookTable.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				int row = bookTable.getSelectedRow();
				idTxt.setText((Integer) bookTable.getValueAt(row, 0) + "");
				bookNameTxt.setText((String) bookTable.getValueAt(row, 1));
				bookAuthorTxt.setText((String) bookTable.getValueAt(row, 2));
				bookPriceTxt.setText((Float) bookTable.getValueAt(row, 3) + "");
				bookDescTxt.setText(bookTable.getValueAt(row, 4) + "");
				String bookTypeName = (String) bookTable.getValueAt(row, 5);
				int n = jcb_bookType.getItemCount();
				for (int i = 0; i < n; i++) {
					BookType item = (BookType) jcb_bookType.getItemAt(i);
					if (item.getBookTypeName().equals(bookTypeName)) {
						jcb_bookType.setSelectedIndex(i);
					}
				}
			}
		});
		bookTable.setToolTipText("\u56FE\u4E66");
		bookTable.setSurrendersFocusOnKeystroke(true);
		bookTable.setModel(new DefaultTableModel(new Object[][] { { null, null,
				null, null, null, null }, }, new String[] {
		});
		mnNewMenu_2.add(menuItem_1);
	}
}
package cn.edu.sau.view;

public class LogonFrm extends JFrame {

	private JPanel contentPane;
	private JTextField userNameTxt;
	private JPasswordField userPasswordTxt;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LogonFrm frame = new LogonFrm();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LogonFrm() {
		setTitle("\u56FE\u4E66\u7BA1\u7406\u7CFB\u7EDF");
		panel.add(bookTypeDescTxt);
		// 修改按钮
		JButton jb_modify = new JButton("\u4FEE\u6539");
		jb_modify.setIcon(new ImageIcon(
				"D:\\java\\MyBookManager\\image\\modify.png"));
		jb_modify.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String bookTypeName = bookTypeNameTxt.getText();
				String bookTypeDesc = bookTypeDescTxt.getText();
				if (StringUtil.isEmpty(bookTypeName)) {
					JOptionPane.showMessageDialog(null, "图书类别名称不能为空");
				}
				BookType bookType = new BookType(bookTypeName, bookTypeDesc);
				bookType.setId(Integer.parseInt(idTxt.getText()));
				Connection con = null;
				try {
					con = dbUtil.getCon();
					int re = bookTypeDao.bookTypeModify(con, bookType);
					if (1 == re) {
						JOptionPane.showMessageDialog(null, "修改成功");
						fillTable(new BookType("", ""));
						reset();
					} else {
						JOptionPane.showMessageDialog(null, "修改失败");
					}
				} catch (Exception e1) {
					JOptionPane.showMessageDialog(null, "修改失败");
					e1.printStackTrace();
				} finally {
					try {
						dbUtil.closeCon(con);
					} catch (Exception e1) {
						e1.printStackTrace();
					}
				}
			}
		});
		jb_modify.setBounds(71, 156, 90, 23);
		panel.add(jb_modify);
		// 删除按钮
					try {
						con = dbUtil.getCon();
						int bookId = (Integer) table.getValueAt(row, 0);

						int ret = userDao.lendBook(con, user.getId(), bookId);
						if (1 == ret) {
							fillTable(new Book());
							JOptionPane.showMessageDialog(null, "借阅成功");
							bookDao.bookLend(con, bookId);
						} else
							JOptionPane.showMessageDialog(null, "借阅失败");
					} catch (Exception e1) {
						JOptionPane.showMessageDialog(null, "借阅失败");
						e1.printStackTrace();
					} finally {
						try {
							dbUtil.closeCon(con);
						} catch (Exception e1) {
							e1.printStackTrace();
						}
					}
				}
			}
		});
		jb_lendBook.setBounds(615, 322, 160, 23);
		contentPane.add(jb_lendBook);

		JLabel label_3 = new JLabel("\u56FE\u4E66\u7F16\u53F7\uFF1A");
		label_3.setBounds(43, 326, 66, 15);
		contentPane.add(label_3);

		s_idTxt = new JTextField();
		s_idTxt.setEnabled(false);
		s_idTxt.setBounds(119, 323, 135, 21);
		contentPane.add(s_idTxt);
		s_idTxt.setColumns(10);

		JLabel label_4 = new JLabel("\u56FE\u4E66\u540D\u79F0\uFF1A");
		label_4.setBounds(340, 326, 66, 15);
		contentPane.add(label_4);

		s_bookNameTxt = new JTextField();
		});
	}

	/**
	 * Create the frame.
	 */
	public BookAddInterFrm() {

		setClosable(true);
		setIconifiable(true);
		setTitle("\u56FE\u4E66\u6DFB\u52A0");
		setBounds(100, 100, 474, 443);
		setLocation(500, 100);
		getContentPane().setLayout(null);

		init();
		fillBookType();

	}

	private void init() {
		JLabel lb_bookName = new JLabel("\u56FE\u4E66\u540D\u79F0\uFF1A");
		lb_bookName.setBounds(29, 39, 72, 15);
		getContentPane().add(lb_bookName);

		bookNameTxt = new JTextField();
		bookNameTxt.setBounds(112, 36, 106, 21);
		getContentPane().add(bookNameTxt);
		bookNameTxt.setColumns(10);

		JLabel lb_bookAuthor = new JLabel("\u56FE\u4E66\u4F5C\u8005\uFF1A");
		lb_bookAuthor.setBounds(236, 39, 72, 15);
		getContentPane().add(lb_bookAuthor);

		bookAuthorTxt = new JTextField();
		bookAuthorTxt.setBounds(304, 36, 101, 21);
		getContentPane().add(bookAuthorTxt);
		bookAuthorTxt.setColumns(10);

		JLabel lb_bookPrice = new JLabel("\u56FE\u4E66\u4EF7\u683C\uFF1A");
		lb_bookPrice.setBounds(29, 100, 72, 15);
		getContentPane().add(lb_bookPrice);

		bookPriceTxt = new JTextField();
		bookPriceTxt.setBounds(112, 97, 106, 21);
		getContentPane().add(bookPriceTxt);
		bookPriceTxt.setColumns(10);
	private JTable table;
	private JTextField s_idTxt;
	private JButton jb_lendBook;
	private JTextField s_bookNameTxt;

	/**
	 * Launch the application.
	 */
	/*
	 * public static void main(String[] args) { EventQueue.invokeLater(new
	 * Runnable() { public void run() { try {
	 * 
	 * UserMainFrm frame = new UserMainFrm(); frame.setVisible(true); } catch
	 * (Exception e) { e.printStackTrace(); } } }); }
	 */

	/**
	 * Create the frame.
	 */
	public UserMainFrm(User user) {

		setTitle("\u501F\u9605\u7CFB\u7EDF");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 835, 445);
		this.user = user;
		JOptionPane.showMessageDialog(null, "欢迎" + user.getPname() + "使用我们的系统");

		init();
		fillTable(new Book());
		this.fillBookType("search");
		this.fillBookType("modify");
	}

	// 填充下拉菜单
	private void fillBookType(String type) {
		Connection con = null;
		BookType bookType = null;
		try {
			con = dbUtil.getCon();
			ResultSet rs = bookTypeDao.bookTypeList(con, new BookType());
			if ("search".equals(type)) {

public class LendBookManageInterFrm extends JInternalFrame {
	DbUtil dbUtil = new DbUtil();
	UserDao userDao = new UserDao();
	BookDao bookDao = new BookDao();

	private JTextField userIdTxt;
	private JTextField bookIdTxt;
	private JTable table;
	private JTextField s_idTxt;
	private JTextField s_userNameTxt;
	private JTextField s_bookNameTxt;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LendBookManageInterFrm frame = new LendBookManageInterFrm();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LendBookManageInterFrm() {
		setIconifiable(true);
		setClosable(true);
		setTitle("\u56FE\u4E66\u501F\u9605\u7BA1\u7406");
		setBounds(100, 100, 691, 448);
		getContentPane().setLayout(null);

		init();
		fillTable(null, null);
	}

	// 填充借书记录表格
	private void fillTable(User user, Book book) {
		DefaultTableModel dtm = (DefaultTableModel) table.getModel();
		dtm.setRowCount(0);
		Connection con = null;
		try {
			con = dbUtil.getCon();
			ResultSet rs = userDao.lendBookList(con, user, book);
				}
				if (StringUtil.isEmpty(userPassword)) {
					JOptionPane.showMessageDialog(null, "密码不能为空");
					return;
				}
				User user = new User(userName, userPassword);
				Connection con = null;

				try {
					con = dbUtil.getCon();
					User reUser = userDao.login(con, user);
					if (reUser != null) {
						dispose();// 销毁登录框
						if (1 == reUser.getRole()) {
							new MainFrm().setVisible(true);// 创建管理员主界面Firme
						} else if (0 == reUser.getRole()) {
							new UserMainFrm(reUser).setVisible(true); // 创建读者界面
						}
					} else {
						JOptionPane.showMessageDialog(null, "用户名或密码不正确");
					}
				} catch (Exception e1) {
					JOptionPane.showMessageDialog(null, "登录失败");
					e1.printStackTrace();
				} finally {
					try {
						con.close();
					} catch (SQLException e1) {
						e1.printStackTrace();
					}
				}

			}
		});
		jb_login.setBounds(102, 191, 93, 23);
		contentPane.add(jb_login);
		// 重置按钮
		JButton jb_reset = new JButton("\u91CD\u7F6E");
		jb_reset.setIcon(new ImageIcon(
				"D:\\java\\MyBookManager\\image\\reset.png"));
		jb_reset.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				reset();
			}
		});
		jb_reset.setBounds(225, 191, 93, 23);
		contentPane.add(jb_reset);

		userPasswordTxt = new JPasswordField();
		userPasswordTxt.setBounds(166, 126, 152, 21);
		contentPane.add(userPasswordTxt);

		JLabel lblNewLabel = new JLabel(" ");
		lblNewLabel.setIcon(new ImageIcon(
				table.add(bookAddInterFrm);
			}
		});
		menu_1.add(jmi_bookAdd);
		// 图书维护菜单项
		JMenuItem jmi_bookManage = new JMenuItem("\u56FE\u4E66\u7EF4\u62A4");
		jmi_bookManage.setIcon(new ImageIcon(
				"D:\\java\\MyBookManager\\image\\bookManager.png"));
		jmi_bookManage.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				BookManageInterFrm bookManageInterFrm = new BookManageInterFrm();
				bookManageInterFrm.setVisible(true);
				table.add(bookManageInterFrm);
			}
		});
		menu_1.add(jmi_bookManage);

		JMenuItem menu_2 = new JMenuItem("\u9000\u51FA");
		menu_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		mn_datamanager.add(menu_2);

		JMenu mn_lendreturn = new JMenu("\u501F\u9605\u7BA1\u7406");
		menuBar.add(mn_lendreturn);

		JMenuItem menuItem = new JMenuItem(
				"\u56FE\u4E66\u501F\u9605\u7BA1\u7406");
		menuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				LendBookManageInterFrm lendBookManageInterFrm = new LendBookManageInterFrm();
				lendBookManageInterFrm.setVisible(true);
				table.add(lendBookManageInterFrm);
			}
		});
		mn_lendreturn.add(menuItem);

		JMenu mnNewMenu_2 = new JMenu("\u5173\u4E8E\u6211\u4EEC");
					}
					userDao.returnBook(con, id);
					bookDao.bookReturn(con, bookName);
					fillTable(null, null);
				} catch (Exception e1) {
					e1.printStackTrace();
				} finally {
					try {
						dbUtil.closeCon(con);
					} catch (Exception e1) {
						e1.printStackTrace();
					}
				}

			}
		});
		jb_return.setBounds(10, 68, 635, 23);
		panel_1.add(jb_return);
	}
}
package cn.edu.sau.view;

public class BookAddInterFrm extends JInternalFrame {
	DbUtil dbUtil = new DbUtil();
	BookTypeDao bookTypeDao = new BookTypeDao();
	BookDao bookDao = new BookDao();
				.getBorder("TitledBorder.border"), "\u641C\u7D22\u6761\u4EF6",
				TitledBorder.LEADING, TitledBorder.TOP, null,
				new Color(0, 0, 0)));
		panel.setToolTipText("\u641C\u7D22\u6761\u4EF6");
		panel.setBounds(10, 24, 655, 58);
		getContentPane().add(panel);
		panel.setLayout(null);

		JLabel lblid = new JLabel("\u7528\u6237Id\uFF1A");
		lblid.setBounds(10, 20, 70, 15);
		panel.add(lblid);

		userIdTxt = new JTextField();
		userIdTxt.setBounds(78, 17, 150, 21);
		panel.add(userIdTxt);
		userIdTxt.setColumns(10);

		JLabel lblid_1 = new JLabel("\u56FE\u4E66Id\r\n\uFF1A");
		lblid_1.setBounds(238, 20, 70, 15);
		panel.add(lblid_1);

		bookIdTxt = new JTextField();
		bookIdTxt.setBounds(318, 17, 155, 21);
		panel.add(bookIdTxt);
		bookIdTxt.setColumns(10);

		// 搜索按钮
		JButton jb_search = new JButton("\u641C\u7D22");
		jb_search.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Connection con = null;
				try {
					con = dbUtil.getCon();
					String userId = userIdTxt.getText();
					String bookId = bookIdTxt.getText();
					Book book = new Book();
					User user = new User();
					if (StringUtil.isNotEmpty(bookId)) {
						book.setId(Integer.parseInt(bookId));
					}
					if (StringUtil.isNotEmpty(userId))
						user.setId(Integer.parseInt(userId));
					rs.getString("pname"));
		}
		return returnUser;
	}

	// 借书
	public int lendBook(Connection con, int userId, int bookId)
			throws Exception {
		String sql = "insert into t_lendbook values(null,?,?)";
		PreparedStatement pstmt = con.prepareStatement(sql);
		pstmt.setInt(1, userId);
		pstmt.setInt(2, bookId);
		return pstmt.executeUpdate();
	}

	// 还书
	public int returnBook(Connection con, String id) throws Exception {
		String sql = "delete from t_lendbook where id=?";
		PreparedStatement pstmt = con.prepareStatement(sql);
		pstmt.setString(1, id);
		return pstmt.executeUpdate();
	}

	// 获取借阅列表
	public ResultSet lendBookList(Connection con, User user, Book book)
			throws Exception {
		StringBuffer sb = new StringBuffer("select * from t_lendbook ");
		if (user != null && user.getId() != -1) {
			sb.append(" and userid = " + user.getId());
		}
		if (book != null && book.getId() != -1) {
			sb.append(" and bookid =" + book.getId());
		}
		PreparedStatement pstmt = con.prepareStatement(sb.toString()
				.replaceFirst("and", "where"));
		return pstmt.executeQuery();
	}

	// 根据id获取用户名
	public String getPnameById(Connection con, int userId) throws Exception {
				String userName = table.getValueAt(row, 1) + "";
				s_userNameTxt.setText(userName.replaceAll("\\(\\d*\\)", ""));
				String bookName = table.getValueAt(row, 2) + "";
				s_bookNameTxt.setText(bookName.replaceAll("\\(\\d*\\)", ""));

			}
		});
		table.setModel(new DefaultTableModel(new Object[][] { { null, null,
				null }, }, new String[] { "\u7F16\u53F7", "\u501F\u9605\u4EBA",
				"\u501F\u9605\u56FE\u4E66" }));
		table.getColumnModel().getColumn(0).setPreferredWidth(83);
		table.getColumnModel().getColumn(1).setPreferredWidth(162);
		table.getColumnModel().getColumn(2).setPreferredWidth(187);
		scrollPane.setViewportView(table);

		JPanel panel_1 = new JPanel();
		panel_1.setBorder(new TitledBorder(null, "\u8868\u5355\u64CD\u4F5C",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel_1.setBounds(10, 276, 655, 101);
		getContentPane().add(panel_1);
		panel_1.setLayout(null);

		JLabel label_2 = new JLabel("\u7F16\u53F7\uFF1A");
		label_2.setBounds(10, 33, 60, 15);
		panel_1.add(label_2);

		s_idTxt = new JTextField();
		s_idTxt.setBounds(91, 30, 66, 21);
		panel_1.add(s_idTxt);
		s_idTxt.setColumns(10);

		JLabel label_3 = new JLabel("\u501F\u9605\u4EBA\uFF1A");
		label_3.setBounds(195, 33, 65, 15);
		panel_1.add(label_3);

		s_userNameTxt = new JTextField();
		s_userNameTxt.setBounds(270, 30, 132, 21);
		panel_1.add(s_userNameTxt);
		s_userNameTxt.setColumns(10);

		JLabel label_4 = new JLabel("\u56FE\u4E66\u540D\u79F0\uFF1A");
		label_4.setBounds(432, 33, 71, 15);
		panel_1.add(label_4);

		s_bookNameTxt = new JTextField();
			}
		});
		bookTypeTable.setModel(new DefaultTableModel(new Object[][] {},
				new String[] { "\u7F16\u53F7",
						"\u56FE\u4E66\u7C7B\u522B\u540D\u79F0",
						"\u56FE\u4E66\u7C7B\u522B\u63CF\u8FF0" }) {
			boolean[] columnEditables = new boolean[] { false, false, false };

			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		bookTypeTable.getColumnModel().getColumn(1).setPreferredWidth(107);
		bookTypeTable.getColumnModel().getColumn(2).setPreferredWidth(243);
		bookTypeTable.setToolTipText("\u56FE\u4E66\u7C7B\u522B");
		bookTypeTable.setSurrendersFocusOnKeystroke(true);
		scrollPane.setViewportView(bookTypeTable);

		JPanel panel = new JPanel();
		panel.setBorder(new TitledBorder(null, "\u8868\u5355\u64CD\u4F5C",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel.setToolTipText("\u8868\u5355\u64CD\u4F5C");
		panel.setBounds(31, 282, 456, 196);
		getContentPane().add(panel);
		panel.setLayout(null);

		JLabel label = new JLabel("\u7F16\u53F7\uFF1A");
		label.setBounds(10, 44, 50, 23);
		panel.add(label);

		idTxt = new JTextField();
		idTxt.setEditable(false);
		idTxt.setBounds(71, 45, 72, 21);
		panel.add(idTxt);
		idTxt.setColumns(10);

		JLabel label_1 = new JLabel(
				"\u56FE\u4E66\u7C7B\u522B\u540D\u79F0\uFF1A");
		label_1.setBounds(156, 48, 96, 15);
		panel.add(label_1);

		bookTypeNameTxt = new JTextField();
		bookTypeNameTxt.setBounds(246, 45, 181, 21);
		panel.add(bookTypeNameTxt);
		bookTypeNameTxt.setColumns(10);

		JLabel label_2 = new JLabel("\u63CF\u8FF0\uFF1A");
		label_2.setBounds(10, 77, 50, 15);
		panel.add(label_2);

		bookTypeDescTxt = new JTextArea();
		bookTypeDescTxt.setBounds(71, 73, 356, 73);
		panel.add(bookTypeDescTxt);
		// 修改按钮

请添加图片描述

请添加图片描述
请添加图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值