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

📄 searchflightsch.java

📁 航空售票系统的代码
💻 JAVA
字号:
package com.tarena.abs.server;import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.*;import java.util.*;import javax.swing.*;import com.tarena.abs.dao.*;import com.tarena.abs.model.*;public class SearchFlightSch extends JDialog implements ActionListener {	private JLabel label0,label1,label2;	private JButton ok,cancel;	private JTextField t1,t2;	public SearchFlightSch(JFrame frame){		super(frame,"查询航班计划");		label0=new JLabel("查询航班计划");		label1=new JLabel("起飞地:");		label2=new JLabel("目的地:");						t1=new JTextField(10);		t2=new JTextField(10);				ok=new JButton("查询");ok.addActionListener(this);		cancel=new JButton("取消");cancel.addActionListener(this);		init();			}	public void init(){		JPanel p=new JPanel();		JPanel p1=new JPanel();		JPanel p2=new JPanel();		JPanel p3=new JPanel();		JPanel p4=new JPanel();		JPanel p5=new JPanel();		p1.add(label0);		p3.setLayout(new FlowLayout(FlowLayout.LEFT));		p4.setLayout(new FlowLayout(FlowLayout.LEFT));		p3.add(label1);p3.add(t1);		p4.add(label2);p4.add(t2);		p.setLayout(new FlowLayout(FlowLayout.LEFT));		p.add(ok);p.add(cancel);				p2.add(p3,BorderLayout.NORTH);		p2.add(p4,BorderLayout.CENTER);				this.add(p1,BorderLayout.NORTH);		this.add(p2,BorderLayout.CENTER);		this.add(p,BorderLayout.SOUTH);			}			public void showMe(){		this.setSize(300,250);		this.setVisible(true);		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);//?	}	public void actionPerformed(ActionEvent e){		if(e.getActionCommand().equals("查询")){			if((t1.getText().equals("") || t2.getText().equals(""))){				JOptionPane.showMessageDialog(new JFrame(), "请输入查询条件");				return;			}			HashSet hsNew=new HashSet();			try { 				FlightDAO f=ServerMainClass.flightDaoSch;				HashSet hs=(HashSet)f.getAllFlightSchedulars();				System.out.println("查到的航班计划:"+hs);				for(Object obj:hs){					FlightSchedular fsc=(FlightSchedular)obj;					System.out.println(fsc.getFromAddress()+" "+fsc.getToAddress());					System.out.println(t1.getText()+" "+t2.getText());					if(fsc.getFromAddress().equals(t1.getText()) && fsc.getToAddress().equals(t2.getText())){						hsNew.add(fsc);					}				}				if(hsNew==null || hsNew.size()==0){					JOptionPane.showMessageDialog(new JFrame(), "没有查到航班计划");					this.dispose();				}else{				//this.dispose();				ArrayList arr=new ArrayList();				arr.addAll(hsNew);				System.out.println("arr="+arr);				String msg = "起始地"+t1.getText()+"到目的地"+t2.getText()+"的航班计划有";				//SearchPanel sp = new SearchPanel(msg,arr);				ServerMainClass.serverMainFrame.setCenterPanel(msg,arr);				}			} catch (Exception e1) {				e1.printStackTrace();			}		}		if(e.getActionCommand().equals("取消")){			this.dispose();		}	}}

⌨️ 快捷键说明

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