?? crmsapplet.java
字號(hào):
/* 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 *//* * CRMSApplet.java * * Created on 27 March 2003, 05:25 */package crms.applet;import javax.swing.*;import java.applet.*;import java.awt.*;import java.util.*;import java.net.*;import crms.util.*;/** * * @author dmurphy */public class CRMSApplet extends javax.swing.JApplet { /** Initialization method that will be called after the applet is loaded * into the browser. */ public static String APPLET_PARAM_USER = "username"; public static String APPLET_PARAM_KEY = "key"; public static String APPLET_PARAM_COMPOSEURL = "compose_url"; boolean isStandalone = false; JPanel bodyPanel = new JPanel(); //Start the applet public void start() { } //Stop the applet public void stop() { } //Destroy the applet public void destroy() { } //Get Applet information public String getAppletInfo() { return "Applet Information"; } //Get parameter info public String[][] getParameterInfo() { String[][] pinfo = { {"Login", "String", ""}, }; return pinfo; } //Main method public static void main(String[] args) { CRMSApplet applet = new CRMSApplet(); applet.isStandalone = true; JFrame frame = new JFrame(); //EXIT_ON_CLOSE == 3 frame.setDefaultCloseOperation(3); frame.setTitle("Applet Frame"); frame.getContentPane().add(applet, BorderLayout.CENTER); frame.getContentPane().setBackground(Color.WHITE); frame.setBackground(Color.WHITE); applet.init(); applet.start(); frame.setSize(760,600); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2); try { frame.setVisible(true); } catch (SecurityException ex) { System.out.println("Got security exception!"); } } public URL getCodeBase() { if (isStandalone) { URL codeBase = null; try { codeBase = new URL(System.getProperty("CRMS_CODEBASE", "http://localhost:8080/crms/")); System.out.println("Codebase is: " + codeBase.toExternalForm()); return codeBase; catch (MalformedURLException ex) { throw new RuntimeException(ex); } } else { System.out.println("Codebase is: " + super.getCodeBase().toExternalForm()); return super.getCodeBase(); } } public void init() { // Create the instance of the ServerFactory // *** This should probably come from Applet parameters getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(Color.WHITE); // ReminderAddPanel panel = new ReminderAddPanel(); //getContentPane().add(new ToolbarPanel(this), BorderLayout.NORTH);// getContentPane().add(panel,BorderLayout.CENTER);// panel.setVisible(true); JPanel statusPanel = new JPanel(); statusPanel.setBackground(Color.WHITE); statusPanel.setLayout(new BorderLayout()); getContentPane().add(statusPanel, BorderLayout.SOUTH); bodyPanel.setLayout(new BorderLayout()); bodyPanel.setBackground(Color.WHITE); bodyPanel.setVisible(true); bodyPanel.add( new HomePanel(), BorderLayout.CENTER); getContentPane().add(bodyPanel, BorderLayout.CENTER); PanelManager.getInstance().setParentPanel(bodyPanel); String userName = null; String key = null; String compose_url = null; if (!isStandalone) { userName = getParameter(APPLET_PARAM_USER); key = getParameter(APPLET_PARAM_KEY); compose_url = getParameter(APPLET_PARAM_COMPOSEURL); } else { userName = System.getProperty("CRMS_USER"); key = System.getProperty("CRMS_PASS"); if (userName == null || key == null) { System.err.println("Please set the CRMS_USER and CRMS_PASS defines on the command line or use the utility ruh.sh"); System.exit(1); } } URL codeBase = getCodeBase(); ServerFactory serverFactory = ServerFactory.getInstance(codeBase.getHost(), codeBase.getPort(), "/crms/crmservlet"); serverFactory.authenticate(userName, key); PanelManager.getInstance().initCache(); PanelManager.getInstance().setComposeURL(compose_url);/* JLabel label = new JLabel("Logged in as CRMS user: " + userName); Font font = label.getFont(); font = font.deriveFont(Font.ITALIC, 10.0f); label.setFont(font); label.setBackground(Color.WHITE); statusPanel.add(label, BorderLayout.WEST); */ PanelManager.getInstance().activatePanel(new HomePanel()); if (!isStandalone) { PanelManager.getInstance().setAppletContext(getAppletContext()); } PanelManager.getInstance().setCodeBase(getCodeBase()); } public boolean isValidateRoot() { return true; }}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -