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

📄 mainapp.java

📁 本文首先介绍了这些考试系统的形成和发展过程
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
package net.robin.crm.ui;

import java.awt.event.KeyEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Event;
import java.awt.BorderLayout;
import javax.swing.KeyStroke;
import javax.swing.JPanel;
import javax.swing.JMenuItem;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JDialog;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JToolBar;
import javax.swing.JButton;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.JTextPane;

import net.robin.crm.service.CRMService;
import net.robin.crm.service.Category;
import net.robin.crm.service.Client;
import net.robin.crm.service.Company;
import net.robin.crm.util.Util;
import javax.swing.JEditorPane;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import javax.swing.ImageIcon;
import javax.swing.JPopupMenu;

public class MainApp extends JFrame {

	private JPanel jContentPane = null;

	private JMenuBar jJMenuBar = null;

	private JMenu fileMenu = null;

	private JMenu editMenu = null;

	private JMenu helpMenu = null;

	private JMenuItem exitMenuItem = null;

	private JMenuItem aboutMenuItem = null;

	private JMenuItem cutMenuItem = null;

	private JMenuItem copyMenuItem = null;

	private JMenuItem pasteMenuItem = null;

	private JMenuItem saveMenuItem = null;

	private JPanel centerPanel = null;

	private JToolBar mainJToolBarBar = null;

	private JButton addCompanyToolButton = null;

	private JButton editCompanyToolButton = null;

	private JSplitPane centerSplitPane = null;

	private JTabbedPane categoryTabbedPane = null;

	private JPanel categoryPanel = null;

	private JPanel companyPanel = null;

	private JScrollPane categoryScrollPane = null;

	private JTree categoryTree = null;

	private JScrollPane companyScrollPane = null;

	private JList companyList = null;

	private JSplitPane clientSplitPane = null;

	private JScrollPane clientScrollPane = null;

	private JTable clientTable = null;

	private CompanyListModel companyListModel = null;  //  @jve:decl-index=0:visual-constraint="836,19"

	private ClientTableModel clientTableModel = null;  //  @jve:decl-index=0:visual-constraint="933,19"

	private ClientInfoPane clientInfoPane = null;

	private AddCompanyDialog addCompanyDialog = null;  //  @jve:decl-index=0:visual-constraint="849,78"

	private EditCompanyDialog editCompanyDialog = null;  //  @jve:decl-index=0:visual-constraint="847,280"

	private JButton removeCompanyToolButton = null;
	
	
	private Action action = new Action();

	private CategoryTreeModel categoryTreeModel = null;  //  @jve:decl-index=0:visual-constraint="1020,18"

	private AddCategoryDialog addCategoryDialog = null;  //  @jve:decl-index=0:visual-constraint="875,494"

	private JButton addCategoryToolButton = null;

	private JButton addClientToolButton = null;

	private AddClientDialog addClientDialog = null;  //  @jve:decl-index=0:visual-constraint="19,625"

	private EditClientDialog editClientDialog = null;  //  @jve:decl-index=0:visual-constraint="554,683"

	private JButton editClientToolButton = null;

	private CategoryTreeCellRenderer categoryTreeCellRenderer = null;  //  @jve:decl-index=0:visual-constraint="1122,12"

	private CompanyListCellRenderer companyListCellRenderer = null;  //  @jve:decl-index=0:visual-constraint="1182,5"

	private ClientColumnTableCellRenderer clientColumnTableCellRenderer = null;  //  @jve:decl-index=0:visual-constraint="1187,79"

	private ClientTableCellRenderer clientTableCellRenderer = null;  //  @jve:decl-index=0:visual-constraint="1114,16"

	private JPopupMenu clientTablePopupMenu = null;  //  @jve:decl-index=0:visual-constraint="1071,689"

	private JMenuItem editClientPopMenuItem = null;

	private JMenuItem addClientPopMenuItem = null;

	private JMenuItem addClientMenuItem = null;

	public MainApp() throws HeadlessException {
		super();
		// TODO 自动生成构造函数存根
		initialize();
	}

	public MainApp(GraphicsConfiguration gc) {
		super(gc);
		// TODO 自动生成构造函数存根
		initialize();
	}

	public MainApp(String title) throws HeadlessException {
		super(title);
		// TODO 自动生成构造函数存根
		initialize();
	}

	public MainApp(String title, GraphicsConfiguration gc) {
		super(title, gc);
		// TODO 自动生成构造函数存根
		initialize();
	}

	/**
	 * This method initializes centerPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getCenterPanel() {
		if (centerPanel == null) {
			centerPanel = new JPanel();
			centerPanel.setLayout(new BorderLayout());
			centerPanel.add(getCenterSplitPane(), java.awt.BorderLayout.CENTER);
		}
		return centerPanel;
	}

	/**
	 * This method initializes mainJToolBarBar	
	 * 	
	 * @return javax.swing.JToolBar	
	 */
	private JToolBar getMainJToolBarBar() {
		if (mainJToolBarBar == null) {
			mainJToolBarBar = new JToolBar();
			mainJToolBarBar.add(getAddCompanyToolButton());
			mainJToolBarBar.add(getEditCompanyToolButton());
			mainJToolBarBar.add(getRemoveCompanyToolButton());
			mainJToolBarBar.add(getAddCategoryToolButton());
			mainJToolBarBar.add(getAddClientToolButton());
			mainJToolBarBar.add(getEditClientToolButton());
		}
		return mainJToolBarBar;
	}

	/**
	 * This method initializes addCompanyToolButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getAddCompanyToolButton() {
		if (addCompanyToolButton == null) {
			addCompanyToolButton = new JButton();
			addCompanyToolButton.setText("添加公司");
			addCompanyToolButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
					action.addCompany();
				}
			});
		}
		return addCompanyToolButton;
	}

	/**
	 * This method initializes editCompanyToolButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getEditCompanyToolButton() {
		if (editCompanyToolButton == null) {
			editCompanyToolButton = new JButton();
			editCompanyToolButton.setText("编辑公司");
			editCompanyToolButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
				
					action.editCompany();
				}
			});
		}
		return editCompanyToolButton;
	}

	/**
	 * This method initializes centerSplitPane	
	 * 	
	 * @return javax.swing.JSplitPane	
	 */
	private JSplitPane getCenterSplitPane() {
		if (centerSplitPane == null) {
			centerSplitPane = new JSplitPane();
			centerSplitPane.setDividerLocation(200);
			centerSplitPane.setRightComponent(getClientSplitPane());
			centerSplitPane.setLeftComponent(getCategoryTabbedPane());
		}
		return centerSplitPane;
	}

	/**
	 * This method initializes categoryTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	private JTabbedPane getCategoryTabbedPane() {
		if (categoryTabbedPane == null) {
			categoryTabbedPane = new JTabbedPane();
			categoryTabbedPane.addTab("分类", null, getCategoryPanel(), null);
			categoryTabbedPane.addTab("公司", null, getCompanyPanel(), null);
		}
		return categoryTabbedPane;
	}

	/**
	 * This method initializes categoryPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getCategoryPanel() {
		if (categoryPanel == null) {
			categoryPanel = new JPanel();
			categoryPanel.setLayout(new BorderLayout());
			categoryPanel.add(getCategoryScrollPane(), java.awt.BorderLayout.CENTER);
		}
		return categoryPanel;
	}

	/**
	 * This method initializes companyPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getCompanyPanel() {
		if (companyPanel == null) {
			companyPanel = new JPanel();
			companyPanel.setLayout(new BorderLayout());
			companyPanel.add(getCompanyScrollPane(), java.awt.BorderLayout.CENTER);
		}
		return companyPanel;
	}

	/**
	 * This method initializes categoryScrollPane	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getCategoryScrollPane() {
		if (categoryScrollPane == null) {
			categoryScrollPane = new JScrollPane();
			categoryScrollPane.setViewportView(getCategoryTree());
		}
		return categoryScrollPane;
	}

	/**
	 * This method initializes categoryTree	
	 * 	
	 * @return javax.swing.JTree	
	 */
	private JTree getCategoryTree() {
		if (categoryTree == null) {
			categoryTree = new JTree();
			categoryTree.setModel(getCategoryTreeModel());
			categoryTree.setCellRenderer(getCategoryTreeCellRenderer());
			categoryTree
					.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
						public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
							//System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged()
						
							action.selectCategoryTree(e);
						}
					});
		}
		return categoryTree;
	}

	/**
	 * This method initializes companyScrollPane	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getCompanyScrollPane() {
		if (companyScrollPane == null) {
			companyScrollPane = new JScrollPane();
			companyScrollPane.setViewportView(getCompanyList());
		}
		return companyScrollPane;
	}

	/**
	 * This method initializes companyList	
	 * 	
	 * @return javax.swing.JList	
	 */
	private JList getCompanyList() {
		if (companyList == null) {
			companyList = new JList();
			companyList.setModel(getCompanyListModel());
			companyList.setCellRenderer(getCompanyListCellRenderer());
			companyList
					.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
						public void valueChanged(javax.swing.event.ListSelectionEvent e) {
							//System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged()
							action.selectCompany();
						}
					});
		}
		return companyList;
	}

	/**
	 * This method initializes clientSplitPane	
	 * 	
	 * @return javax.swing.JSplitPane	
	 */
	private JSplitPane getClientSplitPane() {
		if (clientSplitPane == null) {
			clientSplitPane = new JSplitPane();
			clientSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
			clientSplitPane.setTopComponent(getClientScrollPane());
			clientSplitPane.setBottomComponent(getClientInfoPane());
			clientSplitPane.setDividerLocation(200);
		}
		return clientSplitPane;
	}

	/**
	 * This method initializes clientScrollPane	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getClientScrollPane() {

⌨️ 快捷键说明

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