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);
   }
 }
  public void init() {
    try {
      // data init
      loginId.setText("" + cfg.REQPARAM_SRC_LOGIN_ID);
      password.setText("" + cfg.REQPARAM_SRC_PASSWORD);

      // ui init
      setLayout(new GridLayout(2, 1));
      Panel inputArea = new Panel(new BorderLayout(2, 2));
      inputArea.add(contactList, "Center");
      Panel bottomR = new Panel(new FlowLayout(FlowLayout.RIGHT));
      bottomR.add(loginBtn);
      bottomR.add(logoutBtn);
      bottomR.add(closeBtn);
      Panel bottomL = new Panel(new FlowLayout());
      bottomL.add(new Label("status:"));
      bottomL.add(clientStatus);
      bottomL.add(new Label("  contact:"));
      bottomL.add(contactListEntry);
      bottomL.add(addToContactList);
      bottomL.add(removeFromContactList);
      bottomL.add(getUserDetailsButton());
      bottomL.add(getSendContactsButton());
      Panel bottom = new Panel(new BorderLayout());
      bottom.add("Center", bottomR);
      bottom.add("West", bottomL);
      inputArea.add(bottom, "South");
      Panel leftTop = new Panel(new GridLayout(10, 1));
      leftTop.add(new Label("login id:")); // 1
      leftTop.add(loginId); // 2
      leftTop.add(new Label("password:"******""));
      leftTop.add(new Label("")); // 6

      leftTop.add(new Label("send msg"));
      leftTop.add(sendMsg); // 8
      leftTop.add(new Label("to"));
      leftTop.add(dstLoginId); // 10

      Panel left = new Panel(new FlowLayout());
      left.add(leftTop);
      inputArea.add(left, "West");
      Panel eventLogPanel = new Panel(new BorderLayout());
      eventLogPanel.add("Center", eventLog);
      Panel eventLogPanelButtons = new Panel(new FlowLayout(FlowLayout.RIGHT));
      eventLogPanelButtons.add(clearEventLogBtn);
      eventLogPanel.add("South", eventLogPanelButtons);
      add(inputArea);
      add(eventLogPanel);
      setBackground(SystemColor.control);
      doLayout();
      sendMsg.requestFocus();
    } catch (Throwable tr) {
      CAT.error("exception", tr);
      System.exit(1);
    }
  }
 void enableLoginUI() {
   try {
     logoutBtn.setEnabled(false);
     contactList.setEditable(true);
     loginBtn.setEnabled(true);
     loginId.setEnabled(true);
     password.setEnabled(true);
   } catch (Throwable tr) {
     CAT.error("exception", tr);
   }
 }
 void printException(Throwable tr) {
   CAT.error("exception", tr);
   // StringWriter sw = new StringWriter();
   // PrintWriter pw = new PrintWriter(sw);
   // tr.p rintStackTrace(pw);
   // pw.flush();
   // sw.flush();
   log(
       getMyLoginId()
           + " reports exception:\r\n  "
           + tr.getClass().getName()
           + "\r\n  "
           + tr.getMessage()); // sw.toString());
 }