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

📄 incomecountdialog.java

📁 一个优秀的干洗店管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package view.dialog.countmanage;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.table.DefaultTableModel;
import javax.swing.tree.DefaultMutableTreeNode;

import view.common.CenterWindow;
import view.common.DataPicker;
import view.common.GBC;
import view.control.viewaction.InComeCountDialogTreeAction;

import common.LogWriter;

import control.incomecountaction.InComeCountAction;

public class InComeCountDialog extends JDialog{
	//日期输入框的标签
	private JLabel dateLabel, toLabel;

//	 构造日历控件
	protected DataPicker picker = new DataPicker();
	//用于选择日期的JComboBox
	protected JComboBox fromDateBox,toDateBox;
	//选择统计方式的树
	private JTree tree;
	//最上面的面板
	private JPanel analysePanel;
	//中间的用于显示查询信息的面板
	public JPanel infoPanel;
	//收入记录面板
	private JPanel inComeRecorderPane;	
	private JTabbedPane inComeRecorderTabbedPane;
	//收入记录表
	private JTable inComeTable;
	//会员充值收入详单表、未支付详单表
	private JTable vipInComeDetailTable, unpayDetailTable;
	//会员、普通用户消费详单表
	private JTable vipConsumeDetailTable, commonConsumeDetailTable;
	//赔偿详单表
	private JTable damagedClothesDetailTable;
	//按日、月、年、洗衣类型统计收入表
	private JTable analyseByDayTable,analyseByMonthTable,analyseByYearTable,analyseByTypeTable;
	//	按日、月、年、洗衣类型统计收入面板
	private JPanel analyseByDayPanel,analyseByMonthPanel,analyseByYearPanel,analyseByTypePanel;
	//收入记录JScrollPane
	private JScrollPane inComeTableScrollPane;
	//收入记录面板
	private JPanel inComeRecorderPanel;	
	//用于显示详细信息的面板
	private JPanel detailPanel;
	//收入记录面板在的标签
	private JLabel label;
	//用于放标签的面板
	private JPanel labelPanel;
	//卡片布局
	public CardLayout cl = new CardLayout();
	// 分割面板	
	private JSplitPane splitPane;
	private LogWriter log;
	
	public InComeCountDialog(JFrame frame,LogWriter log){
		super(frame,"收入统计",true);
		this.log = log;
		log.log("进入类InComeCountDialog的构造方法", LogWriter.INFO);
		initialPanel();
	}
	
	private void initialPanel() {
		this.setSize(800, 600);
		CenterWindow.centerWindow(this);
		this.setLayout(new BorderLayout());
		this.add(buildAnalysePanel(), BorderLayout.NORTH);
		this.add(buildSplitPane());

	}

	private JPanel buildAnalysePanel() {
		if(analysePanel == null){
			analysePanel = new JPanel();
			analysePanel.setLayout(new FlowLayout());
			initComponent();
			analysePanel.add(dateLabel);
			analysePanel.add(buildFromDateBox());
			analysePanel.add(this.toLabel);
			analysePanel.add(buildToDateBox());
			analysePanel.add(buildButton("分析"));
			analysePanel.add(buildButton("打印"));
			analysePanel.add(buildButton("退出"));			
		}
		return analysePanel;
	}

	private JSplitPane buildSplitPane() {
		if (splitPane == null) {
			splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
			splitPane.setOneTouchExpandable(true);
			splitPane.setLeftComponent(new JScrollPane(buildInComeTree()));
			splitPane.setRightComponent(buildInfoPanel());
		}
		return splitPane;
	}
	
	public JTree buildInComeTree() {
		if(tree == null){
			 DefaultMutableTreeNode root = new DefaultMutableTreeNode("收入统计");
			 DefaultMutableTreeNode inComeRecorder = new DefaultMutableTreeNode("收入记录");
			 DefaultMutableTreeNode analyseByDay = new DefaultMutableTreeNode("按日分析收入");
			 DefaultMutableTreeNode analyseByMonth = new DefaultMutableTreeNode("按月分析收入");
			 DefaultMutableTreeNode analyseByYear = new DefaultMutableTreeNode("按年分析收入");
			 DefaultMutableTreeNode analyseByType = new DefaultMutableTreeNode("按洗衣类型分析收入");
			 root.add(inComeRecorder);
			 root.add(analyseByDay);
			 root.add(analyseByMonth);
			 root.add(analyseByYear);
			 root.add(analyseByType);
			 tree = new JTree(root);
		}
		tree.setRootVisible(false);
		tree.addTreeSelectionListener(new InComeCountDialogTreeAction(this));
		return tree;
	}
	 public JTree getJTree(){
	    	return tree;
	    }

	public JPanel buildInfoPanel() {
		if(infoPanel == null){
			infoPanel = new JPanel();
			infoPanel.setLayout(cl);			
			infoPanel.add(getInComeRecorderPanel(),"1");
			infoPanel.add(buildAnalysByDayPanel(),"2");			
			infoPanel.add(buildAnalyseByMonthPanel(),"3");	
			infoPanel.add(buildAnalyseByYearPanel(),"4");	
			infoPanel.add(buildAnalyseByTypePanel(),"5");	
			
		}
		return infoPanel;
	}
	
	public JPanel getInComeRecorderPanel(){
		if(inComeRecorderPane == null){
			inComeRecorderPane = new JPanel();
			inComeRecorderPane.setLayout(new BorderLayout());
			inComeRecorderPane.add(buildInComeRecorderTabbedPane());
		}
		return inComeRecorderPane;
	}
	
	public JPanel buildAnalysByDayPanel(){
		if(analyseByDayPanel == null){
			analyseByDayPanel = new JPanel();
			analyseByDayPanel.setLayout(new BorderLayout());
			analyseByDayPanel.setBorder(BorderFactory.createTitledBorder("按日分析收入列表"));
			analyseByDayPanel.add(new JScrollPane(buildAnalysByDayTable())/*,new GBC(0,0).setFill(GBC.BOTH).setWeight(100, 100)*/);
				
		}
		return analyseByDayPanel;
	}
	public JPanel buildAnalyseByMonthPanel(){
		if(analyseByMonthPanel == null){
			analyseByMonthPanel = new JPanel();
			analyseByMonthPanel.setLayout(new BorderLayout());
			analyseByMonthPanel.setBorder(BorderFactory.createTitledBorder("按月分析收入列表"));
			analyseByMonthPanel.add(new JScrollPane(buildAnalysByMonthTable()));
		}
		return analyseByMonthPanel;
	}
	public JPanel buildAnalyseByYearPanel(){
		if(analyseByYearPanel == null){
			analyseByYearPanel = new JPanel();
			analyseByYearPanel.setLayout(new BorderLayout());
			analyseByYearPanel.setBorder(BorderFactory.createTitledBorder("按年分析收入列表"));
			analyseByYearPanel.add(new JScrollPane(buildAnalysByYearTable()));
		}
		return analyseByYearPanel;
	}
	public JPanel buildAnalyseByTypePanel(){
		if(analyseByTypePanel == null){
			analyseByTypePanel = new JPanel();
			analyseByTypePanel.setLayout(new BorderLayout());
			analyseByTypePanel.setBorder(BorderFactory.createTitledBorder("按洗衣类型分析收入列表"));
			analyseByTypePanel.add(new JScrollPane(buildAnalysByTypeTable()));
		}
		return analyseByTypePanel;
	}

	private JTabbedPane buildInComeRecorderTabbedPane() {
		if(inComeRecorderTabbedPane == null){
			inComeRecorderTabbedPane = new JTabbedPane();
			inComeRecorderTabbedPane.add("收入记录列表", buildInComeRecorderPanel());
			inComeRecorderTabbedPane.add("收入统计图表", new JPanel());
		}
		return inComeRecorderTabbedPane;
	}
	
	public JPanel buildInComeRecorderPanel() {
		if (inComeRecorderPanel == null) {
			inComeRecorderPanel = new JPanel();
			inComeRecorderPanel.setLayout(new GridBagLayout());
			inComeRecorderPanel.add(this.buildInComeTableScrollPane(), new GBC(
					0, 0, 1, 6).setFill(GBC.BOTH).setWeight(100, 100));
			inComeRecorderPanel.add(this.buildLabelPanel(), new GBC(0, 6, 1, 1)
					.setFill(GBC.BOTH).setWeight(10, 10));
			inComeRecorderPanel.add(this.buildDetailPanel(),
					new GBC(0, 7, 1, 4).setFill(GBC.BOTH).setWeight(100, 100));
		}
		return inComeRecorderPanel;
	}
	
	public JPanel buildDetailPanel() {
		if (detailPanel == null) {
			detailPanel = new JPanel();
			detailPanel.setLayout(cl);
			detailPanel.add(new JScrollPane(buildVipInComeDetailTable()), "11");
			detailPanel.add(new JScrollPane(buildUnpayDetailTable()), "12");
			detailPanel.add(new JScrollPane(buildVipConsumeDetailTable()), "13");

⌨️ 快捷键说明

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