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

📄 deletelibr.java

📁 用eclipse编写的图书管理系统
💻 JAVA
字号:
package client;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import com.swtdesigner.SwingResourceManager;

import sever.business.iface.ILibrarianInfoIface;
import sever.business.impl.IlibrarianInfoImpl;
import sever.dao.LibrarianInfoDAO;
import sever.db.ConnectionDB;
import sever.entity.BookInfo;
import sever.entity.LibrarianInfo;

public class DeleteLibr extends JFrame {

	/**
	 * Launch the application
	 * @param args
	 */
	
	ImageIcon image=new ImageIcon("E:\\image\\1.JPG");
	ImageIcon image2=new ImageIcon("E:\\image\\3.JPG");
	//ImageIcon image3=new ImageIcon("E:\\image\\2.JPG");

//	public static void main(String args[]) {
//		try {
//			DeleteLibr frame = new DeleteLibr();
//			frame.setVisible(true);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//	}

	/**
	 * Create the frame
	 */
	public DeleteLibr() {
		super();
		setIconImage(SwingResourceManager.getImage(DeleteLibr.class, "/LOGO.jpg"));
		getContentPane().setBackground(new Color(224, 235, 237));
		getContentPane().setLayout(null);
		setBounds(100, 100,365, 208);
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		setTitle("删除管理员");

		final JLabel label = new JLabel();
		label.setFont(new Font("@黑体", Font.PLAIN, 14));
		label.setText("按编号:");
		label.setBounds(21, 42, 60, 15);
		getContentPane().add(label);

		final JTextField textField = new JTextField();
		textField.setBounds(87, 37, 99, 25);
		getContentPane().add(textField);

		final JLabel label_1 = new JLabel();
		label_1.setFont(new Font("@黑体", Font.PLAIN, 14));
		label_1.setText("按姓名:");
		label_1.setBounds(21, 90, 60, 15);
		getContentPane().add(label_1);

		final JTextField textField_1 = new JTextField();
		textField_1.setBounds(87, 85, 99, 25);
		getContentPane().add(textField_1);

		final JButton button = new JButton();
		button.setText("确认");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(textField.getText().length()==0){
					JOptionPane.showMessageDialog(null,"请输入编号");
				}
				else{
				int i=JOptionPane.showOptionDialog(null, "是否删除", "警告", JOptionPane.ERROR_MESSAGE, JOptionPane.YES_NO_OPTION, null,  null,  null);
				if(i==0){
				LibrarianInfo book=new LibrarianInfo();
				
				book.setLibrarianId(Integer.parseInt(textField.getText().trim()));
				ILibrarianInfoIface face=new IlibrarianInfoImpl();
				boolean bl=face.delectpel(book);
				}else{
					dispose();
				}
				
				}
				                                                      //按编号删除管理人员
			}
		});
		button.setFont(new Font("@黑体", Font.PLAIN, 14));
		
		button.setBounds(194, 37, 70, 25);
		getContentPane().add(button);

		final JButton button_1 = new JButton();
		button_1.setText("确认");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(textField_1.getText().length()==0){
					JOptionPane.showMessageDialog(null,"请输入用户名");
				}
				else{
				int i=JOptionPane.showOptionDialog(null, "是否删除", "警告", JOptionPane.ERROR_MESSAGE, JOptionPane.YES_NO_OPTION, null,  null,  null);
				if(i==0){
				LibrarianInfo book=new LibrarianInfo();
				
				book.setLibrarianName(textField_1.getText().trim());
		
				
				ILibrarianInfoIface face=new IlibrarianInfoImpl();
				boolean bl=face.deletepele(book);
				}else{
					dispose();
				}
				}
			}
		});
		button_1.setFont(new Font("@黑体", Font.PLAIN, 14));
		button_1.setBounds(194, 85, 70, 25);
		getContentPane().add(button_1);
		
		
		final JLabel label_2 = new JLabel();
		label_2.setBorder(new TitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
		label_2.setBounds(80, 127, 211, 25);
		getContentPane().add(label_2);

		final JButton button_2 = new JButton();
		button_2.setFont(new Font("@黑体", Font.PLAIN, 14));
		button_2.setText("验证");
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				LibrarianInfo lir=new LibrarianInfo();
				lir.setLibrarianId(Integer.parseInt(textField.getText().trim()));
				ILibrarianInfoIface lirbr=new IlibrarianInfoImpl();
				boolean boo=lirbr.checkNumber(lir);
				if(boo==true){
					label_2.setText("该管理员存在");
				}else{
					label_2.setText("该管理员不存在");
				}
				
			}
		});
		
	
			
		
		button_2.setBounds(270, 37, 70, 25);
		getContentPane().add(button_2);

		
		final JButton button_3 = new JButton();
		button_3.setFont(new Font("@黑体", Font.PLAIN, 14));
		button_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				LibrarianInfo libr=new LibrarianInfo();
				libr.setLibrarianName(textField_1.getText().trim());
				ILibrarianInfoIface lir=new IlibrarianInfoImpl();
				boolean bool=lir.checkName(libr);
				if(bool==true){
					label_2.setText("该管理员存在");
				}else{
					label_2.setText("该管理员不存在");
				}
				
			}
		});
		button_3.setText("验证");
		button_3.setBounds(270, 86, 70, 25);
		getContentPane().add(button_3);
	}

}

⌨️ 快捷键说明

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