public static void main(java.lang.String[] args) { String className = null; try { System.err.println("logging is done using log4j."); final ICQMessagingTest_Applet applet = new ICQMessagingTest_Applet(); className = cfg.REQPARAM_MESSAGING_NETWORK_IMPL_CLASS_NAME.trim(); CAT.info("Instantiating class \"" + className + "\"..."); try { applet.plugin = (MessagingNetwork) Class.forName(className).newInstance(); applet.plugin.init(); } catch (Throwable tr) { CAT.error("ex in main", tr); System.exit(1); } java.awt.Frame frame = new java.awt.Frame("MessagingTest"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { applet.quit(); } }); frame.add("Center", applet); frame.setSize(800, 650); frame.setLocation(150, 100); applet.init(); frame.show(); frame.invalidate(); frame.validate(); applet.start(); } catch (Throwable tr) { CAT.error("exception", tr); System.exit(1); } }
String[] getContactList() { java.util.List cl = new java.util.LinkedList(); StringTokenizer st = new StringTokenizer(contactList.getText()); StringBuffer sb = new StringBuffer(); StringBuffer dbg = new StringBuffer("test applet contactlist: "); while (st.hasMoreTokens()) { String loginId = st.nextToken().trim(); if (loginId.length() == 0) continue; dbg.append("'" + loginId + "' "); cl.add(loginId); sb.append(loginId).append('\n'); } CAT.info(dbg.toString()); contactList.setText(sb.toString()); return (String[]) cl.toArray(new String[cl.size()]); }
void fetchUserDetails() { try { UserDetails d = plugin.getUserDetails(getMyLoginId(), contactListEntry.getText()); String s = getMyLoginId() + " reports: user details for " + contactListEntry.getText() + " are:\r\n nick=" + StringUtil.toPrintableString(d.getNick()) + ",\r\n real name=" + StringUtil.toPrintableString(d.getRealName()) + ",\r\n email=" + StringUtil.toPrintableString(d.getEmail()) + "."; CAT.info(s); log(s); } catch (Exception ex) { printException(ex); } }