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

📄 righttoppanel.java

📁 主要功能包括散客开单、团体开单、宾客结帐、客房预订、营业查询、客户管理、网络设置、系统设置等等。 详细说明见阳光酒店管理系统需求规格说明书。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/**
 *##############################################################################
 *
 *	[ 项目名      ]  : 阳光酒店管理系统
 *  [ 公司名      ]  : 清华IT
 *	[ 模块名      ]  : 主窗口右边房间信息面板
 *	[ 文件名      ]  : RightTopPanel.java
 *	[ 相关文件    ]  : 
 *	[ 文件实现功能]  : 以ViewList控件思想,实现房间图标化
 *	[ 作者        ]  : 顾俊
 *	[ 版本        ]  : 1.0
 *	----------------------------------------------------------------------------
 *	[ 备注        ]  : 
 *	----------------------------------------------------------------------------
 *	[ 修改记录    ]  : 
 *
 *	[ 日  期 ]     [版本]         [修改人]         [修改内容] 
 *	2006/04/23      1.0             顾俊            创建
 *	##--------------------------------------------------------------------------
 *  			 版权所有(c) 2006-2007,  SunshineSOFT Corporation
 *	--------------------------------------------------------------------------##
 *	
 *	[ 函数说明    ]  :		详细说明请看类内各方法开头
 *
 *
 *  [ 遗留问题    ]  : 
 *
 *##############################################################################
 */
package com.sunshine.mainframe;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.sql.*;
import com.sunshine.sunsdk.sql.*;				//公共类
import com.sunshine.sunsdk.swing.*;
import com.sunshine.sunsdk.system.*;


public class RightTopPanel 
extends JPanel 
implements ActionListener, MouseListener {
	
	private JButton rtbt1, rtbt2, rtbt3;
	private JTabbedPane rtp_tb;
	
	private JPanel rjp_bott;
	//定义过滤菜单
	private JPopupMenu pm;
	private JMenuItem mi1, mi2, mi3, mi4;
	
	//保存房间类型ViewList控件面板的哈希表
	private static Hashtable ht;
	//当前标签栏页
	private String tb_Name;
	//筛选房间信息的条件	过滤显示
	private String sqlProviso = "";
	
	
	/**=======================================================================**
	 *		[## public RightTopPanel() {} ]: 				构造函数
	 *			参数   :无
	 *			返回值 :无
	 *			修饰符 :public
	 *			功能   :组建主窗口右边房间信息面板
	 **=======================================================================**
	 */
	public RightTopPanel() {
		super(new BorderLayout());
		
		//制作过滤菜单
		pm = new JPopupMenu();
		mi1 = new JMenuItem("显示可供");
		mi2 = new JMenuItem("显示停用");
		mi3 = new JMenuItem("显示占用");
		mi4 = new JMenuItem("显示预订");
		
		pm.addSeparator();	//加入菜单项
		pm.add(mi1);
		pm.add(mi2);
		pm.add(mi3);
		pm.add(mi4);
		pm.addSeparator();
		
		//存放房间类型
		ht = new Hashtable();
		//房间类型标签栏
		rtp_tb = new JTabbedPane();
		
		//制作标签栏
		buildJTabbedPane();
		
		//设置起始页
		rtp_tb.setSelectedIndex(Integer.parseInt(sunini.getIniKey("Default_Page")));
		
		//制作刷新等按键面板
		rjp_bott = buildrjp_bott();		
		
		//加事件监听
		addListener();
		
		//加入组件
		this.add("South", rjp_bott);
		this.add("Center", rtp_tb);
	}
	
	/**=======================================================================**
	 *		[## private void addListener() {} ]: 
	 *			参数   :无
	 *			返回值 :无
	 *			修饰符 :private
	 *			功能   :加事件监听
	 **=======================================================================**
	 */
	private void addListener() {
		//过滤菜单
		mi1.addActionListener(this);
		mi2.addActionListener(this);
		mi3.addActionListener(this);
		mi4.addActionListener(this);
		//动作监听
		rtbt2.addActionListener(this);
		rtbt3.addActionListener(this);
		//鼠标监听
		rtbt1.addMouseListener (this);
		rtbt2.addMouseListener (this);
		rtbt3.addMouseListener (this);
		rtbt1.addMouseListener (this);
		rtp_tb.addMouseListener(this);
	}
	
	/**=======================================================================**
	 *		[## public void buildJTabbedPane() {} ]: 
	 *			参数   :无
	 *			返回值 :无
	 *			修饰符 :private
	 *			功能   :制作标签栏
	 **=======================================================================**
	 */
	public void buildJTabbedPane() {
		try {
			//获得所有房间类型的名称
			ResultSet rs = sunsql.executeQuery("select r_type,id from roomtype where delmark=0");
			rs.next();
			//获得所有房间类型的数量
			int roomtypeCount = sunsql.recCount(rs);
			String roomtypeName[] = new String[roomtypeCount];	//保存房间类型名数组
			String roomtypeId[]   = new String[roomtypeCount];	//保存房间类型编号数组
			
			//将结果集的信息保存到数组中
			for (int i = 0; i < roomtypeCount; i++) {
				rs.next();
				roomtypeName[i] = rs.getString(1);
				roomtypeId[i]	= rs.getString(2);
			}//Endfor
			
			String sqlCode = "";		//获得指定房间号与房间状态的SQL语句
			//初始化各房间类型面板
			for (int i = 0; i < roomtypeCount; i++) {
				
				sqlCode = "select id,state from roominfo where delmark=0 " +
				"and r_type_id='" + roomtypeId[i] + "' " + sqlProviso;
				
			    //建立一个房间类型的标签栏单页
			    JPanel jp = new JPanel(new GridLayout(1, 1));
			    //制作ViewList面板并加入jp
			    JPanel vl = buildViewList(sqlCode);
			    jp.add(vl);
			    rtp_tb.addTab(roomtypeName[i], jp);
			    
			    //将当前房间类型(ViewList控件)存入哈希表
			    ht.put(roomtypeId[i], vl);
		    }//Endfor
		    tb_Name = rtp_tb.getTitleAt(0);		//获得当前标签栏标题
	    }
	    catch (Exception ex) {
	    	ex.printStackTrace();
	    }//Endtry
	}
	
	/**=======================================================================**
	 *		[## public JPanel buildViewList(String sqlCode) {} ]: 
	 *			参数   :String sqlCode对象表示从数据库中获得指定房间信息
	 *			返回值 :JPanel
	 *			修饰符 :public
	 *			功能   :制作指定房间类型的ViewList控件
	 **=======================================================================**
	 */
	public JPanel buildViewList(String sqlCode) {
		ViewList vl = null;		//定义一个ViewList对象
		String picName = "";	//房间状态图片名称
		try {
			//获得指定房间类型的所有房间号码
			ResultSet vrs = sunsql.executeQuery(sqlCode);
			
			//获得指定房间类型的所有房间数量
			int flag = sunsql.recCount(vrs);
			
			//以房间的数量实例化ViewList控件
			vl = new ViewList(flag);
			
			//将所有房间加入到ViewList里面
			for (int j = 0; j < flag; j++) {
				vrs.next();
				//在ViewList中建立按键
				vl.addButton(vrs.getString(1)).addActionListener(this);
				vl.setButtonImage(vrs.getString(1), vrs.getString(2));
			}//Endfor
			
			//如果按键没有达到要求的个数,VL自动补空
			vl.remeButtons();
		    }
	    catch (Exception ex) {
	    	System.out.println ("RightTopPanel.buildViewList(): false");
	    }//Endtry
	    return vl;
	}
	
	/**=======================================================================**
	 *		[## public static JButton getViewListButton(String roomtypeID, String roominfoID) {} ]: 
	 *			参数   :String roomtypeID对象表示按键对应房间号码的房间类型
	 *					 String roominfoID对象表示与按键对应的房间号码
	 *			返回值 :JButton
	 *			修饰符 :public
	 *			功能   :获得与房间对应的按键
	 **=======================================================================**
	 */
	public static JButton getViewListButton(String roomtypeID, String roominfoID) {
		return ((ViewList)ht.get(roomtypeID)).getButton(roominfoID);
	}

⌨️ 快捷键说明

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