GUI chat room


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: GUI chat room

  1. #1
    Join Date
    Sep 2007
    Posts
    2

    GUI chat room

    I need to do the following:

    write a Java program to implement the GUI for a chat program. The program should include components attached to a form: a text field, a pop-up choice-group and up to 8 string items which will be messages entered by the user. Users should be presented with two commands, ‘Send’ and ‘Exit’.
    Beneath the text field and user selection choice-group, there should always be no more than 8 string items, also identifying which user wrote which message. When a message is added to the group of messages, the text field should be erased ready for the next message. After 8 messages have been added to the group of messages, any additional messages are added to the
    end of the group and the first (oldest) message is removed. Another way to describe this is to display only the last 8 messages entered.


    Can i get any help here?

    Thanks

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    What is your plan for this project? What components and containers are you going to use [that should be evident from the specifications for the project]? What data structures (if any) are you going to use?

  3. #3
    Join Date
    Sep 2007
    Posts
    2

    GUI chat room

    This the code that i did so far.

    Code:
    
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.TextField;
    import javax.microedition.midlet.MIDlet;
    
    public class TextFieldCapture extends MIDlet implements CommandListener {
     private Display display;
    
     private Form form = new Form("GUI chat");
    
     private Command send = new Command("Send", Command.SCREEN, 1);
    
     private Command exit = new Command("Exit", Command.EXIT, 1);
    
     private TextField textfield = new TextField("Type Your message:", "", 90, TextField.ANY);
    
     public TextFieldCapture() {
       display = Display.getDisplay(this);
       form.addCommand(exit);
       form.addCommand(send);
       form.append(textfield);
       form.setCommandListener(this);
     }
    
     public void startApp() {
       display.setCurrent(form);
     }
    
     public void pauseApp() {
     }
    
     public void destroyApp(boolean unconditional) {
     }
    
     public void commandAction(Command command, Displayable displayable) {
       if (command == send) {
         textfield.setString("Hello, " + textfield.getString());
         form.removeCommand(send);
       } else if (command == exit) {
         destroyApp(false);
         notifyDestroyed();
       }
     }
    }
    
    
    // TODO Auto-generated method stub
    Form form = new Form("Chat GUI");
    
    //command options
    TextField textfield =new TextField("TEXT FIELD","",25,TextField.ANY);
    form.append(textfield);
    display.setCurrent(form);
    
    }
    
    }
    But i am stuck here. Any help?

  4. #4
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    I am not familiar with the microedition package and I don't know anything about a MIDlet.

Similar Threads

  1. Java Chat Room
    By JavaHead in forum Java
    Replies: 0
    Last Post: 08-08-2006, 12:21 AM
  2. Chat room
    By gvtolea in forum ASP.NET
    Replies: 7
    Last Post: 03-08-2005, 09:02 PM
  3. Chat Room
    By Doug Threewitt in forum ASP.NET
    Replies: 0
    Last Post: 09-28-2002, 12:32 PM
  4. Re: voice chat room
    By nitin in forum Java
    Replies: 0
    Last Post: 09-24-2001, 09:34 AM
  5. how can I build a CHAT room with ASP
    By Jimmy in forum ASP.NET
    Replies: 1
    Last Post: 12-03-2000, 03:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center