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

📄 removebranchdialog.java

📁 航空售票系统的代码
💻 JAVA
字号:
package com.tarena.abs.server;
import javax.swing.*;

import com.tarena.abs.dao.*;
import com.tarena.abs.model.*;

import java.awt.*;
import java.awt.event.*;
import java.io.File;

public class RemoveBranchDialog extends JDialog implements ActionListener{
	JLabel label0,label1,label2,label3;
	JButton ok,cancel;
	JTextField name,email,passwd;
	public RemoveBranchDialog(JFrame frame){
		super(frame,"删除代理商");
		label0=new JLabel("请输入代理商信息:");
		label1=new JLabel("        用户名:");
	
		ok=new JButton("删除");
		cancel=new JButton("取消");
		name=new JTextField(15);
	
		init();
		eventHandle();
	}
	private void init(){
		JPanel p1=new JPanel();
		p1.add(label0);
		this.add(p1,BorderLayout.NORTH);
		JPanel p2=new JPanel();
		p2.setLayout(new GridLayout(1,2,10,20));
		p2.add(label1);
		p2.add(name);
	
		this.add(p2,BorderLayout.CENTER);
		JPanel p3=new JPanel();
		p3.add(ok);
		p3.add(cancel);
		this.add(p3,BorderLayout.SOUTH);
	}
	private void eventHandle(){
		ok.addActionListener(this);
		cancel.addActionListener(this);
	}
	public void showMe(){
		this.setSize(300,200);
		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		this.setVisible(true);
	}
	public void actionPerformed(ActionEvent e) {
		String comm=e.getActionCommand();
		if(comm.equals("删除")){
			if(name.getText().equals("")){
				JOptionPane.showMessageDialog(this,"姓名不能为空!");
				return;
			}
			BranchDAO dao=ServerMainClass.agentDao;
			boolean success=dao.removeBranch(name.getText());
			if(success){	
				JOptionPane.showMessageDialog(this,"祝贺,代理商删除成功!");
				this.dispose();
			}else{
				JOptionPane.showMessageDialog(this,"代理商删除不成功!");
				name.setText("");
			}
		}else if(comm.equals("取消")){
			this.dispose();
		}
	}
	

}

⌨️ 快捷键说明

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