?? crmspanel.java
字號:
/* CRMS, customer relationship management system Copyright (C) 2003 Service To Youth Council This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information contact the SYC ICT department on GPL@syc.net.au 98 Kermode Street North Adelaide South Australia SA 5006 +61 (0)8 8367 0755 *//* * CRMSPanel.java * * Created on 31 March 2003, 02:46 */package crms.applet;import javax.swing.*;import java.awt.BorderLayout;import java.awt.*;import java.lang.reflect.*;import crms.vo.Permission;/** *@author dmurphy */public abstract class CRMSPanel extends JPanel { /** The Panel is intended to <b>add</b> an item. */ public static final int PANEL_TYPE_ADD = 0; /** The panel mode is to edit an existing item, requires an ID */ public static final int PANEL_TYPE_EDIT = 1; /** Indicate when the panel has not been initialised properly. */ public static int PANEL_TYPE_INVALID = 2; CRMSPanel currentPanel = null; CRMSPanel parent = null; Permission entityPermission = null; /** * This method, when implemented on a concrete class will be responsible * for instantiating components and adding them to this panel. */ public abstract void init(); /** * This method is used by concrete classes to indicate that the * currently visible panel has changed. * *@param newPanel Integer representing the newly active panel. */// public void firePanelChanged(int newPanel) {// remove(getCurrentPanel());//// CRMSPanel panel = null;//// try {// panel = (CRMSPanel) getPanel(newPanel).newInstance();// System.out.println("Just created new instance of: " + panel.getClass());// } catch (Exception ex) {// throw new RuntimeException(ex);// }//// add(panel, BorderLayout.CENTER);// setCurrentPanel(panel);// panel.setVisible(true);// panel.init();//// // Yay! The following line <b>Must</b> be called to// // ensure that the panel repaints itself properly.// panel.revalidate();// } /** * Allows the currently active child panel to be stored on this object. * This must be implemented by the concrete class to ensure that panel * switching can occur. * *@param panel The currently active panel */ public void setCurrentPanel(CRMSPanel panel) { currentPanel = panel; boolean result = panel.requestFocusInWindow(); System.out.println("CRMSPanel.setCurrentPanel: Attempt to requestFocusInWindow = " + result); } /** * Returns the currently active child panel stored on this object. * *@return The currently active child panel. */ public CRMSPanel getCurrentPanel() { return currentPanel; } /** * Overridden method from parent. (Probably unnecessary). * *@param g Description of the Parameter */ public void paintComponent(Graphics g) { super.paintComponent(g); } /** * Returns a new instance of a CRMSPanel object with certain default * properties. This is used to build new panels on the fly. * *@return New CRMSPanel instance. */ public static CRMSPanel getEmptyPanel() { CRMSPanel empty = new CRMSPanel() { public Class getPanel(int i) { return null; } public void init() { } }; empty.setBackground(Color.WHITE); return empty; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -