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

📄 removeagentdialog.java

📁 一个用java实现 的飞机订票系统,超级好用....
💻 JAVA
字号:
package com.zhu.server;import java.awt.Color;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;import org.hibernate.Session;import org.hibernate.Transaction;import com.zhu.util.HbnUtil;/* *  @author zhutingfa */public class RemoveAgentDialog extends JDialog implements ActionListener{	private JLabel label;	private JTextField name;	JButton ok,cancel;	public RemoveAgentDialog(JFrame f) {		super(f,"删除代理商");		label=new JLabel("代理商名字:");		label.setForeground(Color.RED);		name=new JTextField(20);		ok=new JButton("OK");		cancel=new JButton("Cancel");				addEvent();		setLayout(new FlowLayout());		add(label);		add(name);		add(ok);		add(cancel);	}	public void showMe(){		this.setSize(250,150);		this.setLocation(300, 150);		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);		this.setVisible(true);	}	public void addEvent(){		ok.addActionListener(this);		cancel.addActionListener(this);	}	public void actionPerformed(ActionEvent e) {	if(e.getActionCommand().equals("OK")){		if(name.getText().equals("")){			JOptionPane.showMessageDialog(this, "清输入要删除的名字!!");			return;		}		Session s=HbnUtil.getCurrentSession();		Transaction tt=s.beginTransaction();		boolean success=ServerMainClass.agentDao.removeAgent(name.getText());		tt.commit();		if(success)			JOptionPane.showMessageDialog(this, "删除成功!!");			else			JOptionPane.showMessageDialog(this, "用户不存在!!");			this.dispose();		}	else			this.dispose();	}}

⌨️ 快捷键说明

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