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

📄 reserveframe.java

📁 本系统的设计模拟一般学校特别是高校的图书借阅管理内容
💻 JAVA
字号:
/* * Copyright (c) 2006 guodongping. All  Rights Reserved. *  * E-mail: yayajike_0305@163.com * QQ:     445938759 *///package library;import java.awt.Dimension;import java.awt.Rectangle;/*** This code was generated using CloudGarden's Jigloo* SWT/Swing GUI Builder, which is free for non-commercial* use. If Jigloo is being used commercially (ie, by a corporation,* company or business for any purpose whatever) then you* should purchase a license for each developer using Jigloo.* Please visit www.cloudgarden.com for details.* Use of Jigloo implies acceptance of these licensing terms.* ************************************** A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED* for this machine, so Jigloo or this code cannot be used legally* for any corporate or commercial purpose.* **************************************/import javax.swing.JPanel;import java.awt.GridBagLayout;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JTextField;import java.awt.Insets;import java.awt.GridBagConstraints;import java.awt.BorderLayout;import java.sql.Connection;import javax.swing.JButton;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;/** * @author guodongping * 创建日期 2006-1-15 * 预订界面 */public class ReserveFrame extends javax.swing.JInternalFrame {	private JPanel jPanel1;	private JButton okButton;	private JTextField idText;	private JTextField nameText;	private JLabel jLabel2;	private JLabel jLabel1;	public ReserveFrame() {		super("预订",true,true,true,true);		initGUI();	}		private void initGUI() {		try {			setPreferredSize(new Dimension(400, 300));			setBounds(new Rectangle(0, 0, 400, 300));			setVisible(true);			{				jPanel1 = new JPanel();				GridBagLayout jPanel1Layout = new GridBagLayout();				jPanel1Layout.columnWidths = new int[] {7,7};				jPanel1Layout.rowHeights = new int[] {7,7,7};				jPanel1Layout.columnWeights = new double[] {0.05,0.1};				jPanel1Layout.rowWeights = new double[] {0.1,0.1,0.1};				this.getContentPane().add(jPanel1, BorderLayout.CENTER);				jPanel1.setLayout(jPanel1Layout);				{					jLabel1 = new JLabel();					jPanel1.add(jLabel1, new GridBagConstraints(						0,						0,						1,						1,						0.0,						0.0,						GridBagConstraints.CENTER,						GridBagConstraints.NONE,						new Insets(0, 0, 0, 0),						0,						0));					jLabel1.setText("书名:");				}				{					jLabel2 = new JLabel();					jPanel1.add(jLabel2, new GridBagConstraints(						0,						1,						1,						1,						0.0,						0.0,						GridBagConstraints.CENTER,						GridBagConstraints.NONE,						new Insets(0, 0, 0, 0),						0,						0));					jLabel2.setText("读者号:");				}				{					nameText = new JTextField(15);					jPanel1.add(nameText, new GridBagConstraints(						1,						0,						1,						1,						0.0,						0.0,						GridBagConstraints.CENTER,						GridBagConstraints.NONE,						new Insets(0, 0, 0, 0),						0,						0));				}				{					idText = new JTextField(15);					jPanel1.add(idText, new GridBagConstraints(						1,						1,						1,						1,						0.0,						0.0,						GridBagConstraints.CENTER,						GridBagConstraints.NONE,						new Insets(0, 0, 0, 0),						0,						0));				}				{					okButton = new JButton();					jPanel1.add(okButton, new GridBagConstraints(						1,						2,						1,						1,						0.0,						0.0,						GridBagConstraints.CENTER,						GridBagConstraints.NONE,						new Insets(0, 0, 0, 0),						0,						0));					okButton.setText("确定");					okButton.addActionListener(new ActionListener() {						public void actionPerformed(ActionEvent evt) {							okPressed();							//TODO add your code for okButton.actionPerformed						}					});				}			}		} catch (Exception e) {			e.printStackTrace();		}	}		private void okPressed(){		if( nameText.getText()=="" || idText.getText()=="" ){			JOptionPane.showMessageDialog(null,"请填写完整!","错误",JOptionPane.WARNING_MESSAGE);		}		else{			try{				Bridge bridge = new Bridge();				DbManage manage = new DbManage();				//ResultSet rs ;				Connection conn = bridge.getConnection( );				manage.setStatement( conn );				//Date d = new Date();				String sqlCommand = "Insert into reserve(book_name,user_id) values(\'"+					nameText.getText()+"\',\'"+idText.getText()+"\')";				//System.out.println(sqlCommand);				manage.executeInsert( sqlCommand );				JOptionPane.showInternalMessageDialog(this,"预订成功!");			}			catch(Exception e){				e.printStackTrace();				JOptionPane.showMessageDialog(null,e.toString(),"错误",JOptionPane.WARNING_MESSAGE);					}		}	}		/**	* Auto-generated method for setting the popup menu for a component	*/	private void setComponentPopupMenu(		final java.awt.Component parent,		final javax.swing.JPopupMenu menu) {		parent.addMouseListener(new java.awt.event.MouseAdapter() {			public void mousePressed(java.awt.event.MouseEvent e) {				if (e.isPopupTrigger())					menu.show(parent, e.getX(), e.getY());			}			public void mouseReleased(java.awt.event.MouseEvent e) {				if (e.isPopupTrigger())					menu.show(parent, e.getX(), e.getY());			}		});	}}

⌨️ 快捷键说明

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