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

📄 searchflightsch.java

📁 一个用java实现 的飞机订票系统,超级好用....
💻 JAVA
字号:
package com.zhu.server;import java.awt.BorderLayout;import java.awt.Color;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.File;import java.io.FileNotFoundException;import java.util.*;import javax.swing.*;import org.hibernate.Session;import org.hibernate.Transaction;import com.zhu.dao.FlightDAO;import com.zhu.entity.*;import com.zhu.util.HbnUtil;/* *  @author zhutingfa */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("查询航班计划");		label0.setForeground(Color.RED);		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();		showMe();	}	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.CENTER));		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);			}			private void showMe(){		this.setSize(300,250);		this.setLocation(300, 150);		this.setVisible(true);		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);//?	}	public void actionPerformed(ActionEvent e){		if(e.getActionCommand().equals("查询")){			HashSet hsNew=new HashSet();			try { 				FlightDAO f=ServerMainClass.flightDaoSch;				Session s=HbnUtil.getCurrentSession();				Transaction t=s.beginTransaction();				HashSet hs=(HashSet)f.getAllFlightSchedulars();				t.commit();				for(Object obj:hs){					FlightSchedular fsc=(FlightSchedular)obj;					System.out.println(fsc.getFromAddress()+":"+fsc.getToAddress());					if(fsc.getFromAddress().equals(t1.getText()) && fsc.getToAddress().equals(t2.getText())){						hsNew.add(fsc);					}				}				this.dispose();				ArrayList arr=new ArrayList();				arr.addAll(hsNew);				((JFrame)(this.getOwner())).setContentPane(new FlightSchedularListPanel(t1.getText(),t2.getText(),arr));				this.getOwner().setVisible(true);			} catch (Exception e1) {				e1.printStackTrace();			}		}		if(e.getActionCommand().equals("取消")){			this.dispose();		}	}}

⌨️ 快捷键说明

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