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

📄 datehistorysearch.java

📁 小区物业管理系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;
import javax.swing.event.*;

public class DateHistorySearch extends JFrame
{
	private JLabel titleLabel1, titleLabel2, titleLabel3, titleLabel4, dateLabel[], uptownLabel[], buildingLabel;
	private JButton button1, button2, button3, button4, button5;
	private JComboBox dateBox1, dateBox2, dateBox3, dateBox4, uptownBox[], buildingBox;
	private String uptown_name2[], uptown_id2[], building_id[], date1[], room_id[], date2[], date3[], date4[];
	private String uptown_name3[], uptown_id3[], uptown_name4[], uptown_id4[];
	private String inuptownid, inuptownname, inbuilding, indate;
	
	private GridBagConstraints c;
	private Insets inset;
	private GridBagLayout gridbag;
	private int t;
	
	public DateHistorySearch()
	{
		super("类别选择");
		Container panelin = getContentPane();
		gridbag=new GridBagLayout();
		panelin.setLayout(gridbag);
		inset = new Insets(5,5,5,5);
		indate=new String("选择日期");
		
		dateLabel=new JLabel[4];
		uptownLabel=new JLabel[3];
		uptownBox=new JComboBox[3];
		
		building_id=new String[100];
		building_id[0]=new String("选择楼宇");
		
		getuptown();
		getdate1();
		
		titleLabel1=new JLabel("1、查询全部小区");
		c = new GridBagConstraints(2,1,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(titleLabel1,c);
		panelin.add(titleLabel1);
		
		dateLabel[0]=new JLabel("时间");
		c = new GridBagConstraints(2,3,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateLabel[0],c);
		panelin.add(dateLabel[0]);
		
		dateBox1=new JComboBox(date1);
		dateBox1.setMaximumRowCount( 5 );
		c = new GridBagConstraints(3,3,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateBox1,c);
		panelin.add(dateBox1);
		dateBox1.addItemListener(
			new ItemListener() {
				public void itemStateChanged( ItemEvent event )
				{
					int i=0;
					i = dateBox1.getSelectedIndex();
					t++;
					indate=new String(date1[i]);
				}
			}
			);
		
		button1=new JButton("确定");
		c = new GridBagConstraints(11,3,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(button1,c);
		panelin.add(button1);
		button1.addActionListener( 
			new ActionListener(){
				public void actionPerformed( ActionEvent event) {
					if(indate.equals("选择日期"))
					{
						JOptionPane.showMessageDialog(null,"请选择日期后再按确定","Error",JOptionPane.PLAIN_MESSAGE);
					}
					else
					{
						UptownShow us=new UptownShow(indate);
						DateHistorySearch.this.setVisible(false);
					}
				}
			}
			);
			
		titleLabel2=new JLabel("2、查询小区内全部楼宇");
		c = new GridBagConstraints(2,4,2,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(titleLabel2,c);
		panelin.add(titleLabel2);
		
		uptownLabel[0]=new JLabel("小区选择");
		c = new GridBagConstraints(2,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownLabel[0],c);
		panelin.add(uptownLabel[0]);
		
		uptownBox[0]=new JComboBox(uptown_name2);
		uptownBox[0].setMaximumRowCount( 5 );
		c = new GridBagConstraints(3,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownBox[0],c);
		panelin.add(uptownBox[0]);
		uptownBox[0].addItemListener(
			new ItemListener() {
				public void itemStateChanged( ItemEvent event )
				{
					int i=0;
					i = uptownBox[0].getSelectedIndex();
					t++;
					inuptownname=new String(uptown_name2[i]);
					inuptownid=new String(uptown_id2[i]);
					if(t==1)
					{
						DateHistorySearch dhs1=new DateHistorySearch(2,inuptownid, inuptownname);
					}
					DateHistorySearch.this.setVisible(false);
				}
			}
			);
		dateLabel[1]=new JLabel("时间");
		c = new GridBagConstraints(5,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateLabel[1],c);
		panelin.add(dateLabel[1]);
		
		date2=new String[4];
		date2[0]=new String("选择时间");
		dateBox2=new JComboBox(date2);
		dateBox2.setMaximumRowCount( 5 );
		c = new GridBagConstraints(6,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateBox2,c);
		panelin.add(dateBox2);
		
		button2=new JButton("确定");
		c = new GridBagConstraints(11,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(button2,c);
		panelin.add(button2);
		button2.setEnabled(false);
		
		titleLabel3=new JLabel("3、查询小区内的全部业主");
		c = new GridBagConstraints(2,6,2,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(titleLabel3,c);
		panelin.add(titleLabel3);
		
		uptownLabel[1]=new JLabel("小区选择");
		c = new GridBagConstraints(2,7,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownLabel[1],c);
		panelin.add(uptownLabel[1]);
		
		uptownBox[1]=new JComboBox(uptown_name3);
		uptownBox[1].setMaximumRowCount( 5 );
		c = new GridBagConstraints(3,7,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownBox[1],c);
		panelin.add(uptownBox[1]);
		uptownBox[1].addItemListener(
			new ItemListener() {
				public void itemStateChanged( ItemEvent event )
				{
					int i=0;
					i = uptownBox[1].getSelectedIndex();
					t++;
					inuptownname=new String(uptown_name3[i]);
					inuptownid=new String(uptown_id3[i]);
					if(t==1)
					{
						DateHistorySearch dhs1=new DateHistorySearch(3,inuptownid, inuptownname);
					}
					DateHistorySearch.this.setVisible(false);
				}
			}
			);
		dateLabel[2]=new JLabel("时间");
		c = new GridBagConstraints(5,7,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateLabel[2],c);
		panelin.add(dateLabel[2]);
		
		date3=new String[5];
		date3[0]=new String("选择时间");
		dateBox3=new JComboBox(date3);
		dateBox3.setMaximumRowCount( 5 );
		c = new GridBagConstraints(6,7,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateBox3,c);
		panelin.add(dateBox3);
		
		button3=new JButton("确定");
		c = new GridBagConstraints(11,7,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(button3,c);
		panelin.add(button3);
		button3.setEnabled(false);
		
		titleLabel4=new JLabel("4、查询小区内某栋楼的全部业主");
		c = new GridBagConstraints(2,8,2,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(titleLabel4,c);
		panelin.add(titleLabel4);
		
		uptownLabel[2]=new JLabel("小区选择");
		c = new GridBagConstraints(2,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownLabel[2],c);
		panelin.add(uptownLabel[2]);
		
		uptownBox[2]=new JComboBox(uptown_name4);
		uptownBox[2].setMaximumRowCount( 5 );
		c = new GridBagConstraints(3,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownBox[2],c);
		panelin.add(uptownBox[2]);
		uptownBox[2].addItemListener(
			new ItemListener() {
				public void itemStateChanged( ItemEvent event )
				{
					int i=0;
					i = uptownBox[2].getSelectedIndex();
					t++;
					inuptownname=new String(uptown_name4[i]);
					inuptownid=new String(uptown_id4[i]);
					if(t==1)
					{
						DateHistorySearch dhs1=new DateHistorySearch(4,inuptownid, inuptownname);
					}
					DateHistorySearch.this.setVisible(false);
				}
			}
			);
		
		buildingLabel=new JLabel("楼宇选择");
		c = new GridBagConstraints(5,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(buildingLabel,c);
		panelin.add(buildingLabel);
		
		buildingBox=new JComboBox(building_id);
		buildingBox.setMaximumRowCount( 5 );
		c = new GridBagConstraints(6,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(buildingBox,c);
		panelin.add(buildingBox);
		
		dateLabel[3]=new JLabel("时间选择");
		c = new GridBagConstraints(8,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateLabel[3],c);
		panelin.add(dateLabel[3]);
		
		date4=new String[5];
		date4[0]=new String("选择时间");
		dateBox4=new JComboBox(date4);
		dateBox4.setMaximumRowCount( 5 );
		c = new GridBagConstraints(9,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateBox4,c);
		panelin.add(dateBox4);
		
		button4=new JButton("确定");
		c = new GridBagConstraints(11,9,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(button4,c);
		panelin.add(button4);
		button4.setEnabled(false);
		
		setSize(800,600);
		setVisible(true);
	}
	
	public DateHistorySearch(int tt, String uptownid, String uptownname)
	{
		super("类别选择");
		System.out.println("date history search 2 begin");
		Container panelin = getContentPane();
		gridbag=new GridBagLayout();
		panelin.setLayout(gridbag);
		inset = new Insets(5,5,5,5);
		indate=new String("选择日期");
		
		dateLabel=new JLabel[4];
		uptownLabel=new JLabel[3];
		uptownBox=new JComboBox[3];
		building_id=new String[6];
		building_id[0]=new String("选择楼宇");
		
		getuptown();
		getdate1();
		
		inuptownid=new String(uptownid);
		inuptownname=new String(uptownname);
		
		date2=new String[6];
		date2[0]=new String("选择时间");
		date3=new String[6];
		date3[0]=new String("选择时间");
		date4=new String[6];
		date4[0]=new String("选择时间");
		if(tt==2)
		{
			uptown_name2[0]=new String(inuptownname);
			uptown_id2[0]=new String(inuptownid);
			getdate2(inuptownid);
		}
		if(tt==3)
		{
			uptown_name3[0]=new String(inuptownname);
			uptown_id3[0]=new String(inuptownid);
			getdate3(inuptownid);
		}
		if(tt==4)
		{
			uptown_name4[0]=new String(inuptownname);
			uptown_id4[0]=new String(inuptownid);
			getbuilding(inuptownid);
		}
		
		
		System.out.println("init end");
		
		titleLabel1=new JLabel("1、查询全部小区");
		c = new GridBagConstraints(2,1,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(titleLabel1,c);
		panelin.add(titleLabel1);
		
		dateLabel[0]=new JLabel("时间");
		c = new GridBagConstraints(2,3,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateLabel[0],c);
		panelin.add(dateLabel[0]);
		
		dateBox1=new JComboBox(date1);
		dateBox1.setMaximumRowCount( 5 );
		c = new GridBagConstraints(3,3,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(dateBox1,c);
		panelin.add(dateBox1);
		dateBox1.addItemListener(
			new ItemListener() {
				public void itemStateChanged( ItemEvent event )
				{
					int i=0;
					i = dateBox1.getSelectedIndex();
					t++;
					indate=new String(date1[i]);
				}
			}
			);
		
		button1=new JButton("确定");
		c = new GridBagConstraints(11,3,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(button1,c);
		panelin.add(button1);
		button1.addActionListener( 
			new ActionListener(){
				public void actionPerformed( ActionEvent event) {
					if(indate.equals("选择日期"))
					{
						JOptionPane.showMessageDialog(null,"请选择日期后再按确定","Error",JOptionPane.PLAIN_MESSAGE);
					}
					else
					{
						UptownShow us=new UptownShow(indate);
						DateHistorySearch.this.setVisible(false);
					}
				}
			}
			);
		
		System.out.println("step1 end");
			
		titleLabel2=new JLabel("2、查询小区内全部楼宇");
		c = new GridBagConstraints(2,4,2,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(titleLabel2,c);
		panelin.add(titleLabel2);
		
		uptownLabel[0]=new JLabel("小区选择");
		c = new GridBagConstraints(2,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownLabel[0],c);
		panelin.add(uptownLabel[0]);
		
		uptownBox[0]=new JComboBox(uptown_name2);
		uptownBox[0].setMaximumRowCount( 5 );
		c = new GridBagConstraints(3,5,1,1,0,0,10,0,inset,0,0);
		gridbag.setConstraints(uptownBox[0],c);
		panelin.add(uptownBox[0]);
		uptownBox[0].addItemListener(
			new ItemListener() {
				public void itemStateChanged( ItemEvent event )
				{
					int i=0;
					i = uptownBox[0].getSelectedIndex();

⌨️ 快捷键说明

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