首页>代码>java swing结合数据库开发的课程设计:大学城校园美食联盟>/java/大学城校园美食联盟/src/ms/Best_Food.java
package ms;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Best_Food extends JFrame{
	JLabel tips1,tips2,tips3,tips4;
	JTextField wbk1,wbk2,wbk3;
	JButton check1_btn,check2_btn,check3_btn,check4_btn,tc_btn;
	JPanel mb1,mb2,mb3,mb4;
	
	
	public Best_Food()
	{
		super("大学城校园美食联盟-您已登陆");
		tips1=new JLabel("提示:美食导航,请输入菜名或餐馆");
		tips1.setForeground(Color.blue);
		tips2=new JLabel("提示:订位信息查询,请输入餐馆");
		tips2.setForeground(Color.blue);
		tips3=new JLabel("提示:经理信息查询,请输入餐馆或姓名");
		tips3.setForeground(Color.blue);
		tips4=new JLabel("提示: 您可以查询各个餐馆的等级评价");
		tips4.setForeground(Color.blue);
		wbk1=new JTextField(18);
		wbk2=new JTextField(18);
		wbk3=new JTextField(18);
		check1_btn=new JButton("查询");
		check2_btn=new JButton("查询");
		check3_btn=new JButton("查询");
		check4_btn=new JButton("查询");
		tc_btn=new JButton("退出登录");
		tc_btn.setBackground(Color.red);
		tc_btn.addActionListener(new quxiaoListen());
		check1_btn.addActionListener(new Check1_Listen());
		check2_btn.addActionListener(new Check2_Listen());
		check3_btn.addActionListener(new Check3_Listen());
		check4_btn.addActionListener(new Check4_Listen());
		mb1=new JPanel();
		mb2=new JPanel();
		mb3=new JPanel();
		mb4=new JPanel();
		mb1.add(wbk1);mb1.add(check1_btn);mb1.add(tips1,BorderLayout.SOUTH);
		mb2.add(wbk2);mb2.add(check2_btn);mb2.add(tips2,BorderLayout.SOUTH);
		mb3.add(wbk3);mb3.add(check3_btn);mb3.add(tips3,BorderLayout.SOUTH);
		mb4.add(tips4);mb4.add(check4_btn);
		mb4.add(tc_btn,BorderLayout.SOUTH);
		
		mb1.setOpaque(false);
		mb2.setOpaque(false);
		mb3.setOpaque(false);
		mb4.setOpaque(false);
		ImageIcon icon=new ImageIcon("2.jpg");
		JLabel pp=new JLabel(icon);
		pp.setBounds(0, 0, icon.getIconWidth(),icon.getIconHeight() );
		this.getLayeredPane().add(pp,new Integer(Integer.MIN_VALUE));
		JPanel mb5=(JPanel)this.getContentPane();
		mb5.setOpaque(false);
		
		this.setLayout(new GridLayout(4,1));
		this.add(mb1);this.add(mb2);this.add(mb3);this.add(mb4);
		this.setVisible(true);
		this.setSize(400,500);
		this.setLocationRelativeTo(null);//居中显示
		//this.setResizable(false);
	}
	/*退出按钮的监控*/
	class quxiaoListen implements ActionListener{
		public void actionPerformed(ActionEvent e) {
			int ask=JOptionPane.showConfirmDialog(null , "确定要退出系统吗?感谢您使用!" , "警告", JOptionPane.YES_NO_OPTION);
			if(ask==0)
			{
				System.exit(0);
				
			}
		}
		
	}
	//美食查询监听
	class Check1_Listen implements ActionListener
	{
		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO 自动生成的方法存根
			
			String  s=wbk1.getText();//获取文本框的东西
			Show_Food sl= new Show_Food();
			sl.initf(s);//把文本框里获取的东西传进显示信息面板的函数里
			
		}
		
	}
	//订位查询监听
	class Check2_Listen implements ActionListener
	{
		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO 自动生成的方法存根
			String ss=wbk2.getText();//获取文本框的东西
			Show_Booking sl= new Show_Booking();
			sl.initb(ss);//把文本框里获取的东西传进显示信息面板的函数里
		}
		
	}
	//经理信息查询监听
	class Check3_Listen implements ActionListener
	{
		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO 自动生成的方法存根
			String sss=wbk3.getText();//获取文本框的东西
			Show_Manager sl= new Show_Manager();
			sl.initm(sss);//把文本框里获取的东西传进显示信息面板的函数里
		}
		
	}
	//等级评价查询的监听
	class Check4_Listen implements ActionListener
	{
		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO 自动生成的方法存根
			
			new Show_Level();
		
		}
	}

	
}
最近下载更多
Demo1111  LV30 2021年12月12日
tiashishiwo  LV5 2021年7月3日
fdsvsfds  LV2 2021年3月16日
此刀名为秋水  LV1 2021年2月20日
freedom2017  LV14 2020年6月2日
狗比lc  LV1 2020年1月2日
hanyuiqng  LV9 2019年12月24日
啊浩啊  LV7 2019年9月19日
CJ6872400  LV1 2019年7月27日
mangen  LV1 2019年6月25日
最近浏览更多
R8sixsix  LV1 2月27日
廖业贵  LV18 2月23日
adyxhss  LV2 2023年12月25日
shiaomon 2023年12月14日
暂无贡献等级
梅格妮  LV1 2023年12月5日
微信网友_6505997864357888  LV3 2023年11月10日
pangzhihui  LV12 2023年9月22日
zyb10086  LV2 2023年4月8日
jiyun2021  LV9 2023年2月3日
灬艾希  LV9 2023年2月2日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友