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

📄 house.java

📁 我学java时遇到的一些有趣的小项目,虽然很小,但是很实用,例如,applet的记数器,计算机,还有就是applet的一些特效
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
//			for (i = 0; i < cxbutton.length; i++) {
//				res1.next();// 将记录集游标移动到下一行
//				cxbutton[i] = new JButton(); // 从数据库读取记录
//
//				cxbutton[i].setText(res1.getString(1));// 从数据库中读出第一行数据
//
//				String roomstate1 = res1.getString(2);// 从数据库中读出第二列数据
//
//				if (roomstate1.equals("住客净房")) {// 比较第二列的值
//					cxbutton[i].setBackground(Color.GREEN);
//				} else if (roomstate1.equals("空脏房")) {// 比较第二列的值
//					cxbutton[i].setBackground(Color.MAGENTA);
//				} else if (roomstate1.equals("自用房")) {// 比较第二列的值
//					cxbutton[i].setBackground(Color.red);
//				} else if (roomstate1.equals("维修房")) {// 比较第二列的值
//					cxbutton[i].setBackground(Color.lightGray);
//				} else if (roomstate1.equals("住客脏房")) {// 比较第二列的值
//					cxbutton[i].setBackground(Color.orange);
//				} else if (roomstate1.equals("空净房")) {// 比较第二列的值
//					cxbutton[i].setBackground(Color.cyan);
//				}
//				pan1[k].add(cxbutton[i]);
//
//				if ((i + 1) % 10 == 0) {
//					k++;
//				}
//			}
//		} catch (Exception ex) {// 捕获异常信息
//
//		}
//		db.closesql();// 关库
		for (i = 0; i < pan1.length; i++) {
			zcxan.add(pan1[i]);
		}
		mianban2.add(zcxan);

		// 添加面板2中的图例-----------------
		mianban2.add(bq80);
		bq80.setBackground(Color.green);
		bq80.setBounds(50, 560, 50, 30);
		mianban2.add(bq16);
		bq16.setBounds(105, 560, 50, 30);

		mianban2.add(bq81);
		bq81.setBackground(Color.magenta);
		bq81.setBounds(160, 560, 50, 30);
		mianban2.add(bq18);
		bq18.setBounds(215, 560, 50, 30);

		mianban2.add(bq82);
		bq82.setBackground(Color.cyan);
		bq82.setBounds(270, 560, 50, 30);
		mianban2.add(bq20);
		bq20.setBounds(325, 560, 60, 30);

		mianban2.add(bq83);
		bq83.setBackground(Color.orange);
		bq83.setBounds(390, 560, 50, 30);
		mianban2.add(bq22);
		bq22.setBounds(445, 560, 60, 30);

		mianban2.add(bq84);
		bq84.setBackground(Color.red);
		bq84.setBounds(510, 560, 50, 30);
		mianban2.add(bq24);
		bq24.setBounds(565, 560, 60, 30);

		mianban2.add(bq85);
		bq85.setBackground(Color.lightGray);
		bq85.setBounds(625, 560, 50, 30);
		mianban2.add(bq26);
		bq26.setBounds(685, 560, 60, 30);
		mianban2.add(bq27);

		mianban2.add(but11);
		but11.setBounds(770, 30, 100, 40);
		mianban2.add(but12);
		but12.setBounds(770, 80, 100, 40);
		mianban2.add(but13);
		but13.setBounds(770, 130, 100, 40);
		mianban2.add(but14);
		but14.setBounds(770, 180, 100, 40);
		mianban2.add(but15);
		but15.setBounds(770, 230, 100, 40);
		mianban2.add(but16);
		but16.setBounds(770, 280, 100, 40);
		/**
		 * 预定管理界面
		 * 
		 * 
		 */
		ydan = new JPanel();// 实例化用来装按钮面板的面板
		ydan.setLayout(new GridLayout(10, 1));// 设置布局
		ydan.setBounds(20, 200, 750, 340);// 设置位置
		// ydan.setBackground(Color.red);//设置颜色 用来测试大小和位置
		// ydan.setBorder(BorderFactory.createEtchedBorder());

		JPanel[] pan2 = new JPanel[10];// 负责装100个按钮

		for (i = 0; i < pan2.length; i++) {// 循环实例化面板
			pan2[i] = new JPanel();
		}
//
//		db.consql();// 开库
//		ResultSet res2 = db.selectsql("select * from room");// 查询记录集

//		try {// 抛异常
//
//			int z = 0;
//			for (i = 0; i < ydbutton.length; i++) {
////				res2.next();// 将记录集游标移动到下一行
//				ydbutton[i] = new JButton("0101"); // 从数据库读取记录

				//ydbutton[i].setText(res2.getString(1));// 从数据库中读出第一行数据

				//String roomstate2 = res2.getString(2);// 从数据库中读出第二列数据
//				if (roomstate2.equals("住客净房")) {// 比较第二列的值
//					ydbutton[i].setBackground(Color.GREEN);
//				} else if (roomstate2.equals("空脏房")) {// 比较第二列的值
//					ydbutton[i].setBackground(Color.MAGENTA);
//				} else if (roomstate2.equals("自用房")) {// 比较第二列的值
//					ydbutton[i].setBackground(Color.red);
//				} else if (roomstate2.equals("维修房")) {// 比较第二列的值
//					ydbutton[i].setBackground(Color.lightGray);
//				} else if (roomstate2.equals("住客脏房")) {// 比较第二列的值
//					ydbutton[i].setBackground(Color.orange);
//				} else if (roomstate2.equals("空净房")) {// 比较第二列的值
//					ydbutton[i].setBackground(Color.cyan);
//				}
//
//				pan2[z].add(ydbutton[i]);
//
//				if ((i + 1) % 10 == 0) {
//					z++;
//				}
//
//			}
//		} catch (Exception ex) {// 捕获异常信息
//
//		}
//		db.closesql();// 关库
		for (i = 0; i < pan2.length; i++) {
			ydan.add(pan2[i]);
		}

		mianban3.add(ydan);

		mianban3.setLayout(null);

		bq30 = new JLabel("房 间 号:");
		bq31 = new JLabel("房间类型:");
		bq32 = new JLabel("房    价:");
		bq33 = new JLabel("抵达日期:");
		bq34 = new JLabel("预离日期:");
		bq35 = new JLabel("顾客姓名:");
		bq36 = new JLabel("联系方式:");
		bq37 = new JLabel("预   定   管   理");

		bq40 = new JLabel("空 净 房");
		bq41 = new JLabel("空 脏 房");
		bq42 = new JLabel("住客净房");
		bq43 = new JLabel("住客脏房");
		bq44 = new JLabel("自 用 房");
		bq45 = new JLabel("维 修 房");

		txt14 = new JTextField();
		txt15 = new JTextField();
		txt16 = new JTextField();
		txt17 = new JTextField();
		txt18 = new JTextField();
		txt19 = new JTextField();
		txt20 = new JTextField();
		txt21 = new JTextField();
		txt22 = new JTextField();

		mianban3.add(bq30);
		// bq30.setFont(new );
		bq30.setBounds(60, 55, 110, 20);
		mianban3.add(txt14);
		txt14.setBounds(120, 55, 125, 20);

		mianban3.add(bq31);
		bq31.setBounds(new Rectangle(295, 55, 110, 20));

		mianban3.add(xiala1);
		xiala1.setBounds(370, 55, 120, 20);

		xiala1.addItem("请选择房型");
		xiala1.addItem("豪华套房");
		xiala1.addItem("商务套房");
		xiala1.addItem("标准套房");
		xiala1.addItem("豪华标间");
		xiala1.addItem("标 准 间");

		mianban3.add(bq37);
		bq37.setFont(new java.awt.Font("华文新魏", Font.BOLD, 26));
		bq37.setBounds(300, 0, 200, 40);

		mianban3.add(bq32);
		bq32.setBounds(new Rectangle(540, 55, 80, 20));
		mianban3.add(txt16);
		txt16.setBounds(600, 55, 100, 20);

		mianban3.add(bq33);
		bq33.setBounds(new Rectangle(60, 95, 80, 20));
		mianban3.add(txt17);
		txt17.setBounds(new Rectangle(130, 95, 220, 20));
		mianban3.add(bq34);
		bq34.setBounds(new Rectangle(390, 95, 60, 20));
		mianban3.add(txt18);
		txt18.setBounds(new Rectangle(470, 95, 220, 20));

		mianban3.add(bq35);
		bq35.setBounds(60, 135, 80, 20);
		mianban3.add(txt19);
		txt19.setBounds(130, 135, 200, 20);

		mianban3.add(bq36);
		bq36.setBounds(60, 175, 100, 20);
		mianban3.add(txt20);
		txt20.setBounds(130, 175, 260, 20);

		mianban3.add(bq90);
		bq90.setBackground(Color.green);
		bq90.setBounds(50, 560, 50, 30);
		mianban3.add(bq40);
		bq40.setBounds(105, 560, 50, 30);

		mianban3.add(bq91);
		bq91.setBackground(Color.magenta);
		bq91.setBounds(160, 560, 50, 30);
		mianban3.add(bq41);
		bq41.setBounds(215, 560, 50, 30);

		mianban3.add(bq92);
		bq92.setBackground(Color.cyan);
		bq92.setBounds(270, 560, 50, 30);
		mianban3.add(bq42);
		bq42.setBounds(325, 560, 60, 30);

		mianban3.add(bq93);
		bq93.setBackground(Color.orange);
		bq93.setBounds(390, 560, 50, 30);
		mianban3.add(bq43);
		bq43.setBounds(445, 560, 60, 30);

		mianban3.add(bq94);
		bq94.setBackground(Color.red);
		bq94.setBounds(510, 560, 50, 30);
		mianban3.add(bq44);
		bq44.setBounds(565, 560, 60, 30);

		mianban3.add(bq95);
		bq95.setBackground(Color.lightGray);
		bq95.setBounds(625, 560, 50, 30);
		mianban3.add(bq45);
		bq45.setBounds(685, 560, 60, 30);

		mianban3.add(but21);
		but21.setBounds(770, 30, 100, 40);
		mianban3.add(but22);
		but22.setBounds(770, 80, 100, 40);
		mianban3.add(but23);
		but23.setBounds(770, 130, 100, 40);
		mianban3.add(but24);
		but24.setBounds(770, 180, 100, 40);
		mianban3.add(but25);
		but25.setBounds(770, 230, 100, 40);
		mianban3.add(but26);
		but26.setBounds(770, 280, 100, 40);
		/**
		 * 退房管理界面
		 * 
		 */

		mianban4.setLayout(null);
		txt23 = new JTextField();
		txt24 = new JTextField();
		txt25 = new JTextField();
		txt26 = new JTextField();
		txt27 = new JTextField();
		txt28 = new JTextField();
		txt29 = new JTextField();
		txt30 = new JTextField();
		txt31 = new JTextField();

		bq50 = new JLabel("房 间 号:");
		bq51 = new JLabel("房间类型:");
		bq52 = new JLabel("房    价:");
		bq53 = new JLabel("抵达日期:");
		bq54 = new JLabel("退房日期:");
		bq55 = new JLabel("顾客姓名:");
		bq56 = new JLabel("证件号码:");
		bq57 = new JLabel("联系方式:");
		bq58 = new JLabel("(外地手机前加\"0\"或加区号,如:010-88888888)");
		bq59 = new JLabel("消费金额:");
		bq60 = new JLabel("退    房    管    理");
		bq61 = new JLabel("退房时请认真核对金额!!");
		bq62 = new JLabel("认真核对钱币数量,真假!");

		mianban4.add(bq60);
		bq60.setFont(new java.awt.Font("华文新魏", Font.BOLD, 26));
		bq60.setBounds(280, 0, 300, 40);

		mianban4.add(bq50);
		bq50.setBounds(30, 50, 60, 20);
		mianban4.add(txt23);
		txt23.setBounds(90, 50, 140, 20);

		mianban4.add(bq51);
		bq51.setBounds(260, 50, 100, 20);
		mianban4.add(txt24);
		txt24.setBounds(330, 50, 140, 20);

		mianban4.add(bq52);
		bq52.setBounds(500, 50, 140, 20);
		mianban4.add(txt25);
		txt25.setBounds(560, 50, 140, 20);

		mianban4.add(bq53);
		bq53.setBounds(30, 90, 100, 20);
		mianban4.add(txt26);
		txt26.setBounds(100, 90, 220, 20);

		mianban4.add(bq54);
		bq54.setBounds(330, 90, 100, 20);
		mianban4.add(txt27);
		txt27.setBounds(400, 90, 220, 20);

		mianban4.add(bq55);
		bq55.setBounds(30, 130, 100, 20);
		mianban4.add(txt28);
		txt28.setBounds(100, 130, 120, 20);

		mianban4.add(bq56);
		bq56.setBounds(240, 130, 100, 20);
		mianban4.add(txt29);
		txt29.setBounds(320, 130, 320, 20);

		mianban4.add(bq57);
		bq57.setBounds(30, 170, 100, 20);
		mianban4.add(txt30);
		txt30.setBounds(100, 170, 400, 20);
		mianban4.add(bq58);
		bq58.setBounds(500, 170, 500, 20);

		mianban4.add(bq59);
		bq59.setBounds(30, 210, 100, 20);
		mianban4.add(txt31);
		txt31.setBounds(100, 210, 200, 20);

		mianban4.add(bq61);
		bq61.setFont(new java.awt.Font("华文新魏", Font.BOLD, 42));
		bq61.setBounds(180, 280, 600, 100);

		mianban4.add(bq62);
		bq62.setFont(new java.awt.Font("华文新魏", Font.BOLD, 42));
		bq62.setBounds(180, 400, 600, 100);

		mianban4.add(but31);
		but31.setBounds(770, 30, 100, 40);
		mianban4.add(but32);
		but32.setBounds(770, 80, 100, 40);
		mianban4.add(but33);
		but33.setBounds(770, 130, 100, 40);
		mianban4.add(but34);
		but34.setBounds(770, 180, 100, 40);
		mianban4.add(but35);
		but35.setBounds(770, 230, 100, 40);
		mianban4.add(but36);
		but36.setBounds(770, 280, 100, 40);

		this.getContentPane().add(ge1);
		ge1.setBounds(0, 0, 900, 668);

		Container contentPane = this.getContentPane();
		contentPane.setLayout(null);
		// this.setUndecorated(true);
		this.setLayout(null);
		this.setDefaultCloseOperation(3);
		this.setTitle("酒店营业系统");
		this.setBounds(200, 60, 900, 668);
		// this.setEnabled(false);//锁定
		this.setVisible(true);
	}

	public static void main(String[] args) {
		new House1();

	}

	public void actionPerformed(ActionEvent ex) {

	}

	
}

public class House {
	public static void main(String[] args) {
		House1 l = new House1();
		l.setVisible(true);
		l.setSize(400, 500);

	}
}

⌨️ 快捷键说明

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