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

📄 publishdialog.java

📁 一个图书管理系统
💻 JAVA
字号:
package com.UI;import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.CallableStatement;import java.sql.SQLException;import java.sql.Types;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JTextField;import com.DAO.PublishDAO;import com.VO.PublishInfoVO;import com.database.DBAccess;import com.exception.DataBaseException;/*** This code was edited or 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.*/public class PublishDialog extends javax.swing.JDialog {	private JLabel jLabel1;	private JTextField publishID;	private JLabel jLabel2;	private JLabel jLabel4;	private JTextField publishName;	private JTextField pubEmail;	private JTextField pubAdress;	private JTextField pubPhone;	private JButton jButtonDel;	private JButton jButtonAdd;	private JLabel jLabel5;	private JLabel jLabel3;	/**	* Auto-generated main method to display this JDialog	*///	public static void main(String[] args) {//		JFrame frame = new JFrame();//		PublishDialog inst = new PublishDialog(frame);//		inst.setVisible(true);//	}		public PublishDialog(JFrame frame) {		super(frame);		initGUI();	}		private void initGUI() {		DBAccess db=null;		String pubID=null;					try {			db = DBAccess.getDBAccess();			CallableStatement pro=db.getConnection().prepareCall("{call pro_pubID(?)}");			pro.registerOutParameter(1,Types.VARCHAR);			pro.execute();			pubID=pro.getString(1);			pro.close();		} catch (SQLException e1) {			// TODO 自动生成 catch 块			e1.printStackTrace();		}catch (DataBaseException e1) {			// TODO 自动生成 catch 块			e1.printStackTrace();		}				try {			{				getContentPane().setLayout(null);				this.setResizable(false);				this.setLocation(250,180);			}			{				jLabel1 = new JLabel();				getContentPane().add(jLabel1);				jLabel1.setText("\u51fa\u7248\u793e\u7f16\u53f7:");				jLabel1.setFont(new java.awt.Font("宋体",0,14));				jLabel1.setBounds(56, 14, 77, 21);			}			{				publishID = new JTextField();				publishID.setText(pubID);				getContentPane().add(publishID);				publishID.setBounds(147, 7, 133, 28);				publishID.setEditable(false);			}			{				jLabel2 = new JLabel();				getContentPane().add(jLabel2);				jLabel2.setText("\u51fa\u7248\u793e\u540d:");				jLabel2.setBounds(56, 49, 70, 28);				jLabel2.setFont(new java.awt.Font("宋体",0,14));			}			{				jLabel3 = new JLabel();				getContentPane().add(jLabel3);				jLabel3.setText("\u51fa\u7248\u793e\u7535\u8bdd:");				jLabel3.setBounds(56, 84, 91, 28);				jLabel3.setFont(new java.awt.Font("宋体",0,14));			}			{				jLabel4 = new JLabel();				getContentPane().add(jLabel4);				jLabel4.setText("\u51fa\u7248\u793e\u5730\u5740:");				jLabel4.setBounds(56, 126, 84, 28);				jLabel4.setFont(new java.awt.Font("宋体",0,14));			}			{				jLabel5 = new JLabel();				getContentPane().add(jLabel5);				jLabel5.setText("Email:");				jLabel5.setBounds(63, 161, 63, 28);				jLabel5.setFont(new java.awt.Font("宋体",0,14));			}			{				jButtonAdd = new JButton();				jButtonAdd.addActionListener(new MyActionListener());				getContentPane().add(jButtonAdd);				jButtonAdd.setText("\u786e\u5b9a");				jButtonAdd.setBounds(84, 210, 63, 28);				jButtonAdd.setFont(new java.awt.Font("宋体",0,14));			}			{				jButtonDel = new JButton();				jButtonDel.addActionListener(new MyActionListener());				getContentPane().add(jButtonDel);				jButtonDel.setText("\u53d6\u6d88");				jButtonDel.setBounds(203, 210, 63, 28);				jButtonDel.setFont(new java.awt.Font("宋体",0,14));			}			{				pubPhone = new JTextField();				getContentPane().add(pubPhone);				pubPhone.setBounds(147, 84, 133, 28);			}			{				pubAdress = new JTextField();				getContentPane().add(pubAdress);				pubAdress.setBounds(147, 119, 133, 28);			}			{				pubEmail = new JTextField();				getContentPane().add(pubEmail);				pubEmail.setBounds(147, 161, 133, 28);			}			{				publishName = new JTextField();				getContentPane().add(publishName);				publishName.setBounds(147, 42, 133, 28);			}			this.setSize(372, 279);		} catch (Exception e) {			e.printStackTrace();		}	}	class MyActionListener implements ActionListener{		public void actionPerformed(ActionEvent e) {			Object obj=e.getSource();			if (obj==jButtonDel){				PublishDialog.this.dispose();			}else if (obj==jButtonAdd){				PublishDAO publishs=new PublishDAO();				PublishInfoVO publish=new PublishInfoVO();				publish.setPubID(publishID.getText());				publish.setPubName(publishName.getText());				publish.setPubAdress(pubAdress.getText());				publish.setPubPhone(pubPhone.getText());				publish.setPubEmail(pubEmail.getText());				publishs.insert(publish);				PublishDialog.this.dispose();			}		}			}}

⌨️ 快捷键说明

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