Help needed urgent!

hi

i want to run this client code written for jabber server.

only changes u people gotta make is search for string give_username and give_password and replace them with your username and password of your jabber server.if you guyzz are trying to connect to you local server change that one also.search for jabber.org and replace with your server name.

as a open source code supporter i dont have objection if somebody is able to rectify the changes and take credit,but please do post the whole code which is running back on this messgae board as soon as you get it running.it will serve as reference to all the people who are trying to build a jabber client using Smack API.

if somebody can post their code which is running.it would be great.are there any open source supporters who wish to do it ???

and also if anybody can give me links to site where i can get open source jabber client code it would be great.

//code u need to debug  starts here
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.text.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.util.*; public class TedsJabber extends JFrame implements PacketListener, ActionListener, MyJAB {
      public static void main(String args[]) {
        JFrame f = new  TedsJabber(" Jabber Client");
        f.setSize(660, 520);
        Helper.center(f);
        f.pack();
        f.setVisible(true);
         }         public TedsJabber(String header){         setTitle(header);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setBackground(BG_COLOR);
                        usersMap = new HashMap();         panel1 = Helper.makePanel();
        panel2 = Helper.makePanel();
        panel3 = Helper.makePanel();
        panelEmpty = Helper.makePanel();
        logPanel = Helper.makePanel();         JMenuBar menu = new JMenuBar();         JMenu jabbMenu = new JMenu("Options");
        jabbMenu.setMnemonic(''J'');
        JMenuItem addMenu= new JMenuItem("Add contact", ''A'');
        addMenu.addActionListener(this);
        jabbMenu.add(addMenu);
        JMenuItem pwMenu= new JMenuItem("Change Password", ''C'');
        pwMenu.addActionListener(this);
        jabbMenu.add(pwMenu);         menu.add(jabbMenu);       // Adding an Editor panes for logging the incoming msgs
        jabbing = new JEditorPane();         JScrollPane jabbingScroll = new JScrollPane(jabbing);
        jabbing.setEditable(true);         entery = new JEditorPane();
        JScrollPane enteryScroll = new JScrollPane(entery);
        entery.setEditable(true);
        timedCya(entery, "Simple Jabber Client !!!!!");         //Create an instance of SplitPaneDemo
        JSplitPane innerSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                                                    jabbingScroll, enteryScroll);                 innerSplitPane.setResizeWeight(0.8);         innerSplitPane.setBorder(null);         innerSplitPane.setOneTouchExpandable(true);
                //Provide minimum sizes for the two components in the split pane
        jabbing.setPreferredSize(new Dimension(400, 200));
        entery.setPreferredSize(new Dimension(400, 60));         treeTop = new DefaultMutableTreeNode("Roster");
        rosterTree = new TedsTree();         listScrollPane = new JScrollPane(rosterTree);
        listScrollPane.setPreferredSize(new Dimension(150, 320));         //The outer split pane  holds the list and the two text pans
        JSplitPane outerSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                                    listScrollPane, innerSplitPane);         outerSplitPane.setResizeWeight(0.2);
        outerSplitPane.setOneTouchExpandable(true);
        outerSplitPane.setPreferredSize(new Dimension(550, 320));
        outerSplitPane.setMaximumSize(new Dimension(800, 600));         //Add the split pane to this frame
        panel2.add(outerSplitPane);         connectButton = new JButton("Connect");
        connectButton.setBackground(Color.blue);
        connectButton.addActionListener(this);         //panel3.add(joinButton);         logPanel.add(connectButton);         loginSetter = new LoginSetter();         tabOne = new JPanel(new BorderLayout());
        tabOne.add(panelEmpty, BorderLayout.NORTH);
        tabOne.add(loginSetter, BorderLayout.CENTER);
        tabOne.add(logPanel, BorderLayout.SOUTH);         tabTwo = new JPanel(new BorderLayout());         tabTwo.add(panel1,BorderLayout.NORTH);
        tabTwo.add(panel2,BorderLayout.CENTER);
        tabTwo.add(panel3,BorderLayout.SOUTH);         accountSetter = new AccountSetter(this);         tabbedPane = new JTabbedPane();
        tabbedPane.setBackground(BG_COLOR);
        tabbedPane.add("Log In", tabOne);
        getContentPane().add(tabbedPane,BorderLayout.CENTER);         // creates the type of filter we need for the incoming packets
        myFilter = new OrFilter(new PacketTypeFilter(Message.class),
                                new OrFilter(new PacketTypeFilter(Presence.class ),new PacketTypeFilter(IQ.class )));
        rooms = new HashMap();
        jabbers = new HashMap();     }   /** the actions switchboard
        */
  public void actionPerformed(ActionEvent evt){         String command = evt.getActionCommand();              if (command.equals("Connect"))
                connect();             if (command.equals("Add contact"))
                add();             if (command.equals("Change Password"))
                changePW();
            }     /** Implementing the PacketListner processPacket according to the packet type
            */
    public void processPacket(Packet packet){
        if (Message.class.isInstance(packet)){
            Message msg = (Message)packet;
            Message.Type type = msg.getType();
            if(type != Message.Type.GROUP_CHAT && type != Message.Type.CHAT )
                cya(jabbing,"["+msg.getFrom()+ "]  [Type:] "+msg.getType()+"\n"+msg.getBody());
            }         else if (Presence.class.isInstance(packet)){
            Presence presence = (Presence)packet;             // If we got request to subscribe will approve it here automatically
            if(presence.getType() == Presence.Type.SUBSCRIBE){
                String from = presence.getFrom();
                presence.setFrom(presence.getTo());
                presence.setTo(from);
                presence.setType(Presence.Type.SUBSCRIBED);
                connection.sendPacket(presence);                 // Now will add to our roster
                presence.setType(Presence.Type.SUBSCRIBE);
                connection.sendPacket(presence);
                }
            setRoster();
            }
        else if (IQ.class.isInstance(packet)){
            IQ iq = (IQ)packet;
            if(iq.getType() == IQ.Type.RESULT){
                setRoster();
                }
            }
    }     /** resets the roster in any roster change        */     public void rosterModified(){
        setRoster();
    }     /** A method that logs and display the jabbing activity
            It is named after a valley in China
            */
    protected void cya(JEditorPane editorPane, String msg) {         editorPane.setContentType("text/plain");
        editorPane.setFont(new Font("Dialog", Font.BOLD, 11));
        editorPane.setForeground(Color.gray);         Document doc = editorPane.getDocument();
        try{
            //Display the msg
            int offset = doc.getLength();
            doc.insertString(offset, "\n"+msg, null);
            editorPane.setCaretPosition(doc.getLength());
        }catch (Throwable t) {}     }     /** Adds time to cya */
    protected void timedCya(JEditorPane editorPane, String msg) {         Calendar now = new GregorianCalendar();
        String time = (now.get(Calendar.HOUR)+" : "+now.get(Calendar.MINUTE)+" : "
                        +(0>now.get(Calendar.AM_PM)? "PM" : "AM"));         String msgOut = "[" +time+ "] "+msg;
        cya(editorPane, msgOut);
    }     /**  Creating the initial connection    */     private void  connect(){         try{
            if(debug)
                XMPPConnection.DEBUG_ENABLED = true;             // login.priority always have a value from the spinner
            login = loginSetter.getLogin();             connection = new XMPPConnection(login.server, login.port);
            connection.addPacketListener(this,myFilter);
            login();
        }
        catch(XMPPException ex){
            Helper.alert("Failed to Chang Password: "+ex.getXMPPError().getMessage());
            }     }     /**  Once we connect to a server we can login.  These are to separate dependent sequential activities  */     private void login(){         if(connection == null){
            Helper.alert("Please Connect");
            return;
            }         try{
                            connection.login(login.userName, login.password);
                    }
        catch(XMPPException ex){
            int err = ex.getXMPPError().getCode();             // Responding to the various errors appropriately and allowing signing in on the fly
            switch(err){
                case 401:
                case 407:                     int got = JOptionPane.showConfirmDialog(null,
                         "Registration Required Do you wish to register?\nHit NO to edit/change Login info ", "choose one", JOptionPane.YES_NO_OPTION);                     if (got == JOptionPane.YES_OPTION){
                        createAccount();
                        return;
                        }                     //else
                    Helper.alert("Failed to Login"+ex.getXMPPError().getMessage());
                    return;                 default:
                    Helper.alert("Failed to Login"+ex.getXMPPError().getMessage());
                    return;
                }
            }//catch
        logged = true;
        accountSetter.setUserName(login.userName);
        roster = connection.getRoster();
        roster.reload();  //Boy this took a while to get!
        setTitle("JabbAway "+login.userName);
      setRoster();
        tabbedPane.setSelectedIndex(1);
    }     /** creates the actual private chat           */     protected void chat(String jid, String nickName){         if(connection == null  || !logged){
            Helper.alert("Please Login");
            return;
            }
        client = new ChatClient(this, connection, jid, nickName);
        jabbers.put(jid, client);  // not used yet...
        Thread t = new Thread(client);
        t.setDaemon(false);
        t.start();
        }     /** creates a new user account on a jabber server     */     private void createAccount(){         if(connection == null){
            Helper.alert("Please Connect");
            return;
            }             AccountManager accountManager = connection.getAccountManager();             if (accountManager.supportsAccountCreation()){                 try{
                    accountManager.createAccount(login.userName, login.password);
                    login();
                }catch(XMPPException ex){Helper.alert("Failed to Create Account: "+ex.getXMPPError().getMessage());}
            }             else
            {
                JOptionPane.showMessageDialog(null, "Sorry this server does not support creating an account: ",
                                    "alert", JOptionPane.ERROR_MESSAGE);
                }
    }         private void changePW(){
            if(!logged || connection == null){
                Helper.alert("Please Login First");
                return;
                }         AccountManager accountManager   = connection.getAccountManager();
        String pw = JOptionPane.showInputDialog("Please enter new password");
        if( pw.length() > 0 ){
            try{
                accountManager.changePassword(pw);
            }
            catch(XMPPException ex){
                Helper.alert("Failed to Chang Password: "+ex.getXMPPError().getMessage());
                    }
            //register this change at the login object
            login.password = pw;
            Helper.info("Changed Password\nPlease make a note for your new password");
        }
    }         /** starts the roster user adding process            */     private void add(){
        if(connection == null){
            Helper.alert("Please Connect");
            return;
            }         addDialog = new AddDialog(this);
        addDialog.pack();
        addDialog.setVisible(true);
        }     /** show roster set up the Roster and load the buddies into the users map.  This allows us to call
        the JID using just the user (nick)name
        */
    private void setRoster(){         if(connection == null){
            Helper.alert("Please Connect");
            return;
            }         if(roster == null){
            return;
        }         try{             Iterator groups = roster.getGroups();
            Iterator groupItems = null;
            Iterator unfiledItems = roster.getUnfiledEntries();
            RosterGroup group;
            RosterEntry entry = null;
            DefaultMutableTreeNode groupNode = null;
            DefaultMutableTreeNode buddyNode = null;
            treeTop = new DefaultMutableTreeNode("Roster");             while (groups.hasNext()) {
                group = (RosterGroup)groups.next();
                groupNode = new DefaultMutableTreeNode(group.getName());
                treeTop.add(groupNode);
                groupItems= group.getEntries();                 while (groupItems.hasNext()) {
                    entry = (RosterEntry)groupItems.next();
                    String name = entry.getName();
                    if(name == null || name =="")
                        name = StringUtils.parseName( entry.getUser());  // gets the name from the JID if it doesn''t exist :)
                    buddyNode = new DefaultMutableTreeNode(name);
                    groupNode.add(buddyNode);
                    usersMap.put(name, entry.getUser());
                    Presence p = roster.getPresence(entry.getUser());
                    if (p != null){
                        if(p.getType() ==  Presence.Type.AVAILABLE){  // Presence type highlights Will wait for now
                            }
                        }
                    }
                }             if(unfiledItems.hasNext()){
            groupNode = new DefaultMutableTreeNode("Unfilled Items");
            treeTop.add(groupNode);             while (unfiledItems.hasNext()) {
                entry = (RosterEntry)unfiledItems.next();
                String name = entry.getName();
                if( name == null || name =="")
                    name = StringUtils.parseName( entry.getUser());  // as above for the unfiled
                buddyNode = new DefaultMutableTreeNode(name);
                groupNode.add(buddyNode);
                usersMap.put(name, entry.getUser());
                Presence p = roster.getPresence(entry.getUser());
                    if (p != null){
                        if(p.getType() ==  Presence.Type.AVAILABLE){ // ditto
                            }
                        }
                    }
                }             rosterTree.setModel(new DefaultTreeModel(treeTop));         }catch(Exception e){
            System.out.println("setRoster exception "+e);
            }
    }         /** A class that creates the Tree display of the Roster */     public class TedsTree extends JTree{         public TedsTree(){
            super();
            this.getSelectionModel().setSelectionMode
                    (TreeSelectionModel.SINGLE_TREE_SELECTION);             // set up node icons
            DefaultTreeCellRenderer renderer
             = new DefaultTreeCellRenderer();
                      this.setCellRenderer(renderer);             //Listen for when the selection changes.
            this.addTreeSelectionListener(new TreeSelectionListener() {
                public void valueChanged(TreeSelectionEvent e) {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
                                       getLastSelectedPathComponent();                     if (node == null) return;                     Object roterEntry = node.getUserObject();
                    if (node.isLeaf()) {
                        rosterSelectionString = (String)roterEntry;
                        String jid = (String)usersMap.get(rosterSelectionString);
                        //get a chat here
                        chat((String)usersMap.get(rosterSelectionString), rosterSelectionString);
                        }
                    }
                });
            }
        }     /** this was supposed to be quick  :-)        */     class AddDialog extends JDialog {         private JOptionPane optionPane;
        JTextField jidTextField ;
        JTextField nameTextField ;          public AddDialog(TedsJabber client) {
                super(client, true);                 setTitle("Add Jabber");                 JLabel jidLabel = new JLabel("Jabber ID: ");
                JLabel nameLabel = new JLabel("Nick Name: ");                 jidTextField = new JTextField("user@jabber.org",15);
                nameTextField = new JTextField("myBuddy",15);                 JPanel jidPanel = new JPanel();
                JPanel namePanel = new JPanel();                 jidPanel.add(jidLabel);
                jidPanel.add(jidTextField);                 namePanel.add(nameLabel);
                namePanel.add(nameTextField);                 Object[] array = {jidPanel, namePanel};                 JButton button = new JButton("Add Jabber");
                button.addActionListener(client);
                Object[] op = {button};                 optionPane = new JOptionPane(array,
                                                                     JOptionPane.QUESTION_MESSAGE,
                                                                     JOptionPane.OK_OPTION,
                                                                     null,
                                                                     op);
                setContentPane(optionPane);
                setDefaultCloseOperation(DISPOSE_ON_CLOSE);             }
        }       // stuff
    JPanel panel1,  panel2, panel3, logPanel, panelEmpty, roomsPanel;
    JEditorPane jabbing, entery ;
    JPanel jabbingPanel, enteryPanel, tabOne, tabTwo, tabThree;
    JButton joinButton, connectButton;
    XMPPConnection connection;
    TedsJabber.TedsTree rosterTree;
    JScrollPane listScrollPane ;
    Roster roster;
    RosterEntry rosterSelection;
    ChatClient client;
    JTabbedPane tabbedPane;
    AccountSetter accountSetter;
    LoginSetter loginSetter;
    DefaultMutableTreeNode treeTop;
    String rosterSelectionString;
    Map usersMap;
    Login login;
    LineNumberReader lineReader;
    JComboBox roomsComboBox;
    PacketFilter myFilter;
    AddDialog addDialog;
    boolean logged = false;
    HashMap rooms, jabbers ;
}   //adding helper here
  class Helper implements MyJAB  {     public static JPopupMenu makePopupMenu(Object[] items, Object target) {     JPopupMenu m = new JPopupMenu();     for (int i = 0; i < items.length; i++) {
      if (items+ == null) {
        m.addSeparator();
      }
      else {
        m.add(makeMenuItem(items+, target));
      }
    }     return m;
  }     public static JMenuItem makeMenuItem(Object item, Object target)   {     JMenuItem r = null;
    if (item instanceof String) {
      r = new JMenuItem( (String) item);
    }
    else if (item instanceof JMenuItem) {
      r = (JMenuItem) item;
    }
    else {
      return null;
    }     if (target instanceof ActionListener) {
      r.addActionListener( (ActionListener) target);
    }
    return r;
  }   public static JMenu makeMenu(Object parent, Object[] items, Object target)   {     JMenu m = null;
    if (parent instanceof JMenu) {
      m = (JMenu) parent;
    }
    else if (parent instanceof String) {
      m = new JMenu( (String) parent);
    }
    else {
      return null;
    }     for (int i = 0; i < items.length; i++) {
      if (items+ == null) {
        m.addSeparator();
      }
      else {
        m.add(makeMenuItem(items+, target));
      }
    }     return m;
  }    public static JPanel makeComboPanel(JComboBox dBox, ActionListener frame,
                                      String title, String[] item) {     JPanel dPanel = new JPanel();
    dPanel.setBorder(funBorder(title));      for (int i = 0; i < item.length; i++) {
      dBox.addItem(item+);
    }     //set initial an selection
    dBox.setSelectedIndex(0);
    dBox.addActionListener(frame);
    dPanel.add(dBox);
    return dPanel;
  }     public static JPanel makeComboPanel(JComboBox dBox, String[] item) {     JPanel dPanel = new JPanel();
    dPanel.setBorder(funBorder());         for (int i = 0; i < item.length; i++) {
      dBox.addItem(item+);
    }     //set initial an selection
    dBox.setSelectedIndex(0);
    dPanel.add(dBox);
    return dPanel;
  }   /** Build a Combo Panel for an ActionListener.   */   public static JPanel makeComboPanel(JComboBox dBox, Vector items) {     JPanel dPanel = new JPanel();
    dPanel.setBorder(funBorder());
    Iterator iter = items.iterator();     //dBox = new JComboBox();     while(iter.hasNext()) {
      dBox.addItem(iter.next());
    }     //set initial an selection
    dBox.setSelectedIndex(0);
    dPanel.add(dBox);
    return dPanel;
  }   /** Builds the preferred application''s borders.
   */
  public static Border funBorder(String title) {
    Border etched, compound;     etched = BorderFactory.createEtchedBorder();     //Add a title to the etched frame. (separated for readability)
    compound = BorderFactory.createTitledBorder(
        etched,
        title
        );     return compound;
  }   /** Builds the preferred application''s borders.
   */
  public static Border funBorder() {
    Border etched;     etched = BorderFactory.createEtchedBorder();
    return etched;
  }   public static Border raisedBevel() {
    Border raisedbevel = BorderFactory.createRaisedBevelBorder();
    return raisedbevel;
  }   public static JPanel makePanel() {
    JPanel panel = new JPanel();
    panel.setBorder(funBorder());
   // panel.setBackground(BG_COLOR);
    return panel;
  }     /** Builds an Item Entry Panel.
   */
  public static JPanel makeJItemPanel(JComponent comp, String title, JComponent parent)   {
    JPanel dPanel = new JPanel();
    dPanel.setBackground(BG_COLOR);
    dPanel.setBorder(Helper.funBorder(title));
    dPanel.add(comp);
    parent.add(dPanel);
    return dPanel;
  }   /** Builds the PassWord Entry Panel.
   */
  public static JPanel makePWEntryPanel(JPasswordField jpw, String title, String text,int width,
                                          JComponent parent)   {
    JPanel dPanel = new JPanel();
    dPanel.setBackground(BG_COLOR);
    dPanel.setBorder(Helper.funBorder(title));     jpw.setColumns(width);
    jpw.setText(text);
    dPanel.add(jpw);
    parent.add(dPanel);     return dPanel;
  }     public static void alert(String msg) {
    JOptionPane.showMessageDialog(null,
                                  msg, "alert",
                                  JOptionPane.ERROR_MESSAGE
                                  );
  }         public static void info(String msg) {
        JOptionPane.showMessageDialog(null,
                                  msg, "information",
                                  JOptionPane.INFORMATION_MESSAGE
                                  );
  }   public static void center(java.awt.Container theFrame) {     Dimension frameSize = theFrame.getSize();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    theFrame.setLocation( (screenSize.width - frameSize.width) / 2,
                         (screenSize.height - frameSize.height) / 2);
  }   public static void bottom(JFrame theFrame) {     Dimension frameSize = theFrame.getSize();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    theFrame.setLocation( (screenSize.width - frameSize.width) / 2,
                         (screenSize.height - frameSize.height));
  }   public static void bottomRt(Window theFrame) {     Dimension frameSize = theFrame.getSize();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    theFrame.setLocation( (screenSize.width - frameSize.width),
                         (screenSize.height - frameSize.height)-WIN_BAR);
  }   public static void top(JFrame theFrame) {     Dimension frameSize = theFrame.getSize();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    theFrame.setLocation( (screenSize.width - frameSize.width) / 2, 0);
  }   public static void topLt(JFrame theFrame) {     theFrame.setLocation( 0, 0);
  } private static final int WIN_BAR = 40; } //adding account here
/** a class that holds the extra information vCard
        */ class Account{     public Account(String fName,String lName, String email,
                 String city, String state, String zip, String phone,
                 String url, String text ){         this.fName = fName;
        this.lName = lName;
        this.email = email;
        this.city = city;
        this.state = state;
        this.zip = zip;
        this.phone = phone;
        this.url = url;
        this.text =text;
        this.date =new Date().toString();         map = new HashMap();         map.put("first", fName);
        map.put("last", lName);
        map.put("email", email);
        map.put("city", city);
        map.put("state", state);
        map.put("zip", zip);
        map.put("phone", phone);
        map.put("url", url);
        map.put("date", date);
        map.put("text", text);         }         /** helps in updating the account as the packet takes a map
                */
        public Map getMap(){
            return map;
        }     String fName, lName, email, city, state, zip, phone, url, text, date;
    Map map;
} //adding account setter class AccountSetter extends JPanel implements MyJAB{ public AccountSetter(TedsJabber tedsJabber){     // dataEntryPnl as a Box to get a rows like layout
    mAccountPanel    = new JPanel(new BorderLayout());
    subAccountPanel     = new JPanel(new BorderLayout());
    textAccountPanel    = new JPanel();
    bottomAccountPanel  = Helper.makePanel();     accountBox = Box.createHorizontalBox();
    accountBox.setBackground(BG_COLOR);
    sub1Box = Box.createVerticalBox();
    sub1Box.setBackground(BG_COLOR);
    sub2Box = Box.createVerticalBox();
    sub2Box.setBackground(BG_COLOR);
    sub3Box = Box.createVerticalBox();
    sub3Box.setBackground(BG_COLOR);
    accountBox.add(sub1Box);
    accountBox.add(sub2Box);     userNameTB  = new JTextField();
    fNameTB     = new JTextField();
    lNameTB     = new JTextField();
    emailTB     = new JTextField();
    cityTB      = new JTextField();
    stateTB     = new JTextField();
    zipTB       = new JTextField();
    phoneTB     = new JTextField();
    urlTB       = new JTextField();
    textTB      = new JTextPane();
    textTB.setText("Java Developer");
    JScrollPane textScroll = new JScrollPane(textTB);
    textTB.setPreferredSize(new Dimension(400, 60));
    textTB.setEditable(true);
    userNameTB.setEditable(false);     updateButton = new JButton("Update");
    updateButton.setBackground(Color.blue);
    updateButton.addActionListener(tedsJabber);
    bottomAccountPanel.add(updateButton);     userNamePanel = makeDataEntryPanel(userNameTB, "User Name", "Tedweitz",ENTRY_WIDTH);
    fnamePanel = makeDataEntryPanel(fNameTB, "First Name", "Ted",ENTRY_WIDTH);
    lnamePanel = makeDataEntryPanel(lNameTB, "Last Name", "Weitz",ENTRY_WIDTH);
    emailPanel = makeDataEntryPanel(emailTB, "e Mail", "weitz@fas.harvard.edu",ENTRY_WIDTH);
    cityPanel = makeDataEntryPanel(cityTB, "City", "Cambridge",ENTRY_WIDTH);
    statePanel = makeDataEntryPanel(stateTB, "State", "MA",ENTRY_WIDTH);
    zipPanel = makeDataEntryPanel(zipTB, "Zip", "02139",ENTRY_WIDTH);
    urlPanel = makeDataEntryPanel(urlTB, "Web Site URL","www.tedweitz.com", ENTRY_WIDTH *2);     textPanel = Helper.makeJItemPanel(textScroll, "Description", textAccountPanel);
    sub3Box.add(textPanel);     mAccountPanel.add(subAccountPanel, BorderLayout.CENTER);
    subAccountPanel.add(userNamePanel, BorderLayout.NORTH);
    subAccountPanel.add(accountBox, BorderLayout.CENTER);
    subAccountPanel.add(sub3Box, BorderLayout.SOUTH);
    mAccountPanel.add(bottomAccountPanel, BorderLayout.SOUTH);
    this.add(mAccountPanel);     setBackground(BG_COLOR);
    userNameTB.setEnabled(false);     }   /** Builds the Data Entry Panel.
   */
  public static JPanel makeDataEntryPanel(JTextField jtf, String title, String text,int width)   {
    JPanel dPanel = new JPanel();
    dPanel.setBackground(BG_COLOR);
    dPanel.setBorder(Helper.funBorder(title));     jtf.setColumns(width);
    jtf.setText(text);
    dPanel.add(jtf);     return dPanel;
  }     public Account getAccount(){         String fName, lName, email, city , state, zip, phone, url, text;         fName = fNameTB.getText().trim();
        lName = lNameTB.getText().trim();
        email = email = emailTB.getText().trim();
        city = cityTB.getText().trim();
        state = stateTB.getText().trim();
        zip = zipTB.getText().trim();
        phone = phoneTB.getText().trim();
        url = urlTB.getText().trim();
        text = textTB.getText().trim();         return new Account(fName, lName, email, city , state, zip, phone, url, text);
    }     public void setUserName(String name){
        //userNameTB.setEnabled(true);
        userNameTB.setText(name);
        //userNameTB.setEnabled(false);
    } JPanel mAccountPanel, subAccountPanel, textAccountPanel, bottomAccountPanel, userNamePanel,
        fnamePanel, lnamePanel, emailPanel, cityPanel,  statePanel, zipPanel, phonePanel, urlPanel, textPanel; Box accountBox, sub1Box, sub2Box, sub3Box;
JTextField userNameTB, fNameTB , lNameTB, emailTB, cityTB,  stateTB, zipTB, phoneTB, urlTB  ;
JTextPane textTB;
JButton updateButton;
private static final int ENTRY_WIDTH = 20; } //adding Chat Client
/** A class that handles the private chat with individual users.  It runs on its own thread so each chat gets
        its own thread.
        */ class ChatClient extends JDialog implements PacketListener, Runnable, KeyListener, MyJAB { public ChatClient(TedsJabber client, XMPPConnection connection, String buddy, String nickName){
     super(client, "ChatAway "+client.login.userName);
     this.connection = connection;
     this.buddy = buddy;
     this.client = client;
     this.nickName = nickName;
     setDefaultCloseOperation(DISPOSE_ON_CLOSE);      buildUI(); }   public void run() {       chat = new Chat(connection,buddy);
      chat.addMessageListener(this);
      show();
      }   private void buildUI(){         try{
            //setRootPaneCheckingEnabled(true);             panel1 = Helper.makePanel();
            panel2 = Helper.makePanel();
            panel3 = Helper.makePanel();             JLabel heading = new JLabel("Private Chat with "+buddy);
            heading.setForeground(new Color(137,177,211));
            panel1.add(heading);             // Adding an Editor panes
            jabbing = new JEditorPane();
            JScrollPane jabbingScroll = new JScrollPane(jabbing);
            jabbing.setEditable(false);             entery = new  JTextArea();
            JScrollPane enteryScroll = new JScrollPane(entery);
            entery.setEditable(true);
            entery.addKeyListener(this);
            client.timedCya(jabbing, "Chatting with: "+buddy);             //Create an instance of SplitPaneDemo
            JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                                                    jabbingScroll, enteryScroll);             //Lets both cells resize with the same weight
            splitPane.setResizeWeight(0.0);
            splitPane.setOneTouchExpandable(true);
            //innerSplitPane.setDividerLocation(180);             jabbingScroll.setPreferredSize(new Dimension(320, 160));
            enteryScroll.setPreferredSize(new Dimension(320, 60));
            panel2.add(splitPane);             getContentPane().add(panel1,BorderLayout.NORTH);
            getContentPane().add(panel2,BorderLayout.CENTER);
            getContentPane().add(panel3,BorderLayout.SOUTH);
            setSize(360, 340);
            Helper.bottomRt(this);
        }
        catch(Throwable t){
        System.out.println("Got Error in costructor: "+t+"\n\n");
            t.printStackTrace(System.out);
            }
    }     public void processPacket(Packet packet){
      Message msg = (Message)packet;
      Message.Type type = msg.getType();
      if( type == Message.Type.CHAT || type == Message.Type.NORMAL)
        client.timedCya(jabbing,"["+nickName+"]  "+msg.getBody());
    }     public void keyTyped(KeyEvent evt)
    {}     public void keyReleased(KeyEvent evt)
    {}     public void keyPressed(KeyEvent evt)
    {
    // we are only listening to entery
    int keyCode = evt.getKeyCode();     if (keyCode == KeyEvent.VK_ENTER  && evt.isShiftDown())
    try{
        entery.getDocument().insertString(entery.getCaretPosition(), "\n", null);
          // Boy... this alows multiline entery
      }catch(Exception e){/*I am sorry*/}     else if (keyCode == KeyEvent.VK_ENTER){
        String jab = entery.getText();         // removing the extra \n
        if(jab.startsWith("\n"))
            jab = jab.substring(1,jab.length());         if(jab.endsWith("\n"))
            jab = jab.substring(0,jab.length());         try{
            chat.sendMessage(jab);
        }
        catch(XMPPException e){Helper.alert(e.getXMPPError().toString());}         entery.setDocument(new PlainDocument());
        entery.setCaretPosition(0);
        client.timedCya(jabbing,"["+client.login.userName+ "]  "+jab);
      }
    }         /** check for a similar chat as buddy holds the full jid (with resource as oppose to just name
                as romeo@montague.net/desctop  is not similar to romeo@montague.net/wireless
                */
        public boolean equals (ChatClient client){             return buddy.equals(client.buddy);
    }   /** Overriding hashCode as we are going to use the client for storage in a hash
      */
  public int hashCode()
  {
        if(buddy != null)
        return buddy.hashCode();
      else return super.hashCode();
  }     JPanel panel1,  panel2, panel3, panelFill;
    JEditorPane jabbing  ;
    JPanel jabbingPanel, enteryPanel;
    JButton sendButton, endButton;
    JScrollPane listScrollPane ;
    XMPPConnection connection;
    String buddy;
    TedsJabber client;
    String nickName;
    Chat chat;
    JTextArea entery;
}
//adding login class Login{     public Login(String server, int port, String userName, String password ){         this.server = server;
        this.port = port;
        this.userName = userName;
        this.password = password;
        }     public String toString(){
        return "Server :"+server+" Port "+port+" userName "+userName+" password "
                +password;
        }
    String server, userName, password;
     int port;
    }
//adding login setter
/** A class that creats the login panel where the initial information is set
        */
class LoginSetter extends JPanel implements MyJAB{ public LoginSetter(){      try{
    Vector serversVector = new Vector();
    String line = new String();     portTB      = new JTextField();
    userNameTB  = new JTextField();
    passwordTB  = new JPasswordField();        userNamePanel = makeDataEntryPanel(userNameTB, "User Name", "vithal",ENTRY_WIDTH);
    passwordPanel = makeDataEntryPanel(passwordTB, "Password", "raja",ENTRY_WIDTH);
       setBackground(BG_COLOR);     }catch(Exception e){
        System.out.println("LoginSetter error in constructor "+e);
        }     }   /** Builds the Data Entry Panel.
   */
  public static JPanel makeDataEntryPanel(JTextField jtf, String title, String text,int width)   {
    JPanel dPanel = new JPanel();
    dPanel.setBackground(BG_COLOR);
    dPanel.setBorder(Helper.funBorder(title));     jtf.setColumns(width);
    jtf.setText(text);
    dPanel.add(jtf);     return dPanel;
  }     public String getUserName(){
        return userNameTB.getText().trim();
    }     public Login getLogin(){         String server, userName, password, resource;
        int port;         server = "oraclon";
        port = 5222;
        userName = userNameTB.getText().trim();
        password = new String(passwordTB.getPassword());
       return new Login(server, port, userName, password);     } LineNumberReader lineReader;
JPanel  userNamePanel, passwordPanel;
JTextField portTB, userNameTB ;
JPasswordField passwordTB;
private static final int ENTRY_WIDTH = 20; } //adding MYJab interface MyJAB {
    int SUB_PNLS = 3;
    int DEFAULT_PORT = 5222;
    String DEFAULT_SERVER  = "oraclon";
    String ME = "raja";
    String MY_PW = "raja";
    boolean debug = true ;
    Color BG_COLOR = new Color(0,93,231);
}

oops sorry i have given wrong strings to search for user name and pasword.

search for raja for both username and password.

Sorry Matt i’'ve posted a very long message.i cant help it i just wanted to share my code.

Sara

is anybody working out withe code i’'ve posted ???

Sara

hey

are there any takers for my code ??? just curious to know if any one is working on the code i’'ve posted !!!

Sara

In a previous thread you could hardly execute your own code (java -jar …) so to be honest I doubt if you wrote this yourself.

Even if you did it isn’'t really usefull to post your entire program.

I’'m also wondering why you need pointers to an open source jabber client if you wrote one yourself?

Oh look what I’'ve found after a quick google:

http://tedweitz.com/harvard/cscie258/proj/docs/cscie258/TWeitz/proj/TedsJabber.h tml

Message was edited by: botpad