Chat Program - GUI Help needed.

Ello, I'm making a chat client, and I've got a slight problem :
In the chatwindow, you usually have a field where the text is typed, and when <enter> is pressed, this text is sent to the server and to the textpane.
I'm looking to make something similar to MSN : for that particular field I want a multiline widget (I can put it inside a JScrollPane), that throws an ActionEvent when <enter> is pressed.
Does anybody know of a component for me?
thx,
SJG

You could use a JTextArea for the MultiLine stuff and add:
myTextArea.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == 10) // I think enter is 10
// do somethinf
I think the key code is 10 for enter but not 100% sure.
I hope this helps.

Similar Messages

  • HT2515 audio chat with ichat -- help needed!

    I have just purchased a new macbook air and i am new to MAC. I am  unable to do audio chat through ichat (google talk) with others who are using gtalk on windows enabled PC/ laptops..can some one pleas help me through? Thanks...

    Hi,
    iChat uses the same protocols to do Video or Audio chats no matter if you use an "AIM" Buddy List or  "Jabber" one.
    However in the Case of a Jabber one, the Buddy also has to be using iChat.
    This is because Jabber Apps (including the standalone App called Googletalk for PCs) use different Protocols to do Video and Audio Chats.
    You could both use a Browser and Use Mebeam
    (Type in a room "name"  once you are in the room copy the URL of the page and send it to your Buddy to invite them)
    This uses Flash which you have to have On in your Browser.
    If you have a Google Mail ID and have Enabled Talk on your Account you could download the Google Web Browser Plug-in and Chat on the Google pages.
    9:06 PM      Monday; July 9, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Registry program - desperate help needed

    Hi everyone.
    Wel... i only hav a few years experiance with java and basically i would like to create a USB writer blocker as a project for university. Basically this allows you to view a USB device and its contents but not write to the data leaving it unchanged (just incase anyone was unsure what this was). Anyway i was wondering if anyone had any tips on how to go about this? I was planning on writing a program that would manipulate the appropriate registry key values to allow this to occur but can java do this? if so could anyone point me in the direction of starting?
    Sorry for asking so much but help would be appreciated SOOO much!!
    Thanks

    Hi everyone.
    Wel... i only hav a few years experiance with java
    and basically i would like to create a USB writer
    blocker as a project for university. Basically this
    allows you to view a USB device and its contents but
    not write to the data This is not a suitable Java project. Namely because none of it will be written in Java. So pick a different project or a different language.

  • First GUI help needed - replace JPanel?

    Hello guys,
    I'm trying to develop my first GUI and I'm using Netbeans to create the GUI
    here's an image of what I have: http://www.imagebullet.com/i/Sv3FrBmURS6V.gif
    the central part of the GUI is a JPanel (the big part that contains "welcome to ...")
    now I'd like to create a new JPanel with Netbeans to replace the current one when I click store new password from the tasks menu (see the image)
    how can I do it? is this the correct approach at developing a GUI? or is there something I'm completely missing?
    Edited by: Icecube on Mar 8, 2008 6:35 AM

    Icecube wrote:
    I'm trying to develop my first GUI and I'm using Netbeans to create the GUIThat may be your first mistake. The more you offload code creation to another program (the NetBeans GUI builder), the less you understand about the concepts. If you really want to learn about coding a GUI, learn to do it without code generation software by going through the Sun Swing tutorials.
    now I'd like to create a new JPanel with Netbeans to replace the current one when I click store new password from the tasks menu (see the image)
    how can I do it? is this the correct approach at developing a GUI? or is there something I'm completely missing?You could use a CardLayout as one way to solve this. Again, check out the tutorials for this (you can search the tutorial), and also check the API. Good luck.

  • Java GUI Help Needed

    Can someone help me find a link, book, tutorial or anything along those lines that can help me understand building a GUI in Java? Thanks, Jeremy

    When I was about to create my first GUI I used an IDE with "visual" capabilities. You design the GUI by using drag-and-drop and filling in tables, and then the IDE generates the code automatically for you. I found this helpful because Swing is so complex and in this way you get your options presented to you and you can study the generated code.

  • GUI Help Needed

    *////The declaration*
    Entry [] entries  - array of entries
    Int eno      - number of Entrys in entries
    Int MAXE = 100; maximum number of entrys in entries
    Int current ? index in entries of entry *///////I have few Jtextfields in a GUI where when I click ?new? Jbutton it would put the Jtextfields in entries[eno] can I know how to write this code .*
    Public void actionPerformed (ActionEvent E) {
    If (e.getSource==new) ;
    Sorry not sure how to write plz help
    }

    What is an Entry? What is an Int?
    I have few Jtextfields in a GUI where when I click ?new? Jbutton it would put the Jtextfields in entries[eno] can I know how to write this code .If you want to put the JTextFields in entries[], then entries has to be of type JTextField[]. Or do you want to put the strings that were entered into the JTextFields into entries[]?
    Here is my attempt:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    class MyWindow extends JFrame implements ActionListener
      private ArrayList<JTextField> textBoxes;
      private ArrayList<String> entries;
      public MyWindow()
        //Initialize frame:
        super("Testing");
        setBounds(20, 100, 500, 500);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        textBoxes = new ArrayList<JTextField>();
        entries = new ArrayList<String>();
        //Create textboxes:
        textBoxes.add(new JTextField("", 20));
        textBoxes.add(new JTextField("", 30));
        //Create button:
        JButton newButton = new JButton("new");
        newButton.addActionListener(this);
        //'this'-->look in this class for actionPerformed() method
        //Create panel:
        JPanel panel = new JPanel();
        for(JTextField textBox: textBoxes)
          panel.add(textBox);
        panel.add(newButton);
        //Add panel to window:
        Container cpane = getContentPane();
        cpane.add(panel);
      public void actionPerformed(ActionEvent ev)
        for(JTextField textBox: textBoxes)
          entries.add(textBox.getText());
        for(String str: entries)
          System.out.println(str);
    public class WindowTest
      public static void createAndShowGui()
        MyWindow win = new MyWindow();
        win.setVisible(true);
      public static void main(String args[])
        //The proper way to launch a java gui:
        Runnable runner = new Runnable()
          public void run()
            createAndShowGui();
        SwingUtilities.invokeLater(runner);
    }Or maybe you don't know how many JTextFields there are in the window? Is the user adding them dynamically?
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    class MyWindow extends JFrame implements ActionListener
      private ArrayList<JTextField> entries;
      JPanel panel;
      public MyWindow()
        //Initialize frame:
        super("Testing");
        setBounds(20, 100, 500, 500);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        entries = new ArrayList<JTextField>();
        //Create textboxes:
        //Create button:
        JButton newButton = new JButton("new");
        newButton.addActionListener(this);
        //'this'-->look in this class for actionPerformed() method
        //Create panel:
        panel = new JPanel();
        panel.add(new JTextField("", 20));
        panel.add(new JTextField("", 20));
        panel.add(newButton);
        //Add panel to window:
        Container cpane = getContentPane();
        cpane.add(panel);
      public void actionPerformed(ActionEvent ev)
        int count = panel.getComponentCount();
        System.out.println(count);
        Component comp = null;
        for(int i=0; i<count; ++i)
          comp = panel.getComponent(i);
          if(comp.getClass() == JTextField.class)
            entries.add((JTextField)comp);
        for(JTextField tf: entries)
          System.out.println(tf.getText());
    public class WindowTest
      public static void createAndShowGui()
        MyWindow win = new MyWindow();
        win.setVisible(true);
      public static void main(String args[])
        Runnable runner = new Runnable()
          public void run()
            createAndShowGui();
        SwingUtilities.invokeLater(runner);
    }

  • Using swing i have problem of garblled gui. help needed...

    i have created a desktop software.
    when i use it on windows 98 i have problem. mouse disturbes the gui apparance. it just creates squares on gui as it moves.
    why??
    on windows 2000 or XP it 's ok

    Go to www.icloud.com.  Remove the device from your Find My iPhone there.
    Find My iPhone Activation Lock: Removing a device from a ...

  • Re: Course management system gui help needed

    "How should I go about doing this?"
    how about a google for servlets
    and what should I use?"
    your brain
    a little bit of effort
    servlets chapter 11
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
    jdbc for database access
    http://java.sun.com/docs/books/tutorial/jdbc/index.html
    tomcat to host servlets
    http://jakarta.apache.org/tomcat/

    i bought it second hand, i've got a snow leopard disc that came with it. it tells me it can't restart to the 'untitled' drive thats part of the hard drive when i go through he start up/reboot process.

  • Need Help with Simple Chat Program

    Hello Guys,
    I'm fairly new to Java and I have a quick question regarding a simple chat program in java. My problem is that I have a simple chat program that runs from its own JFrame etc. Most of you are probably familiar with the code below, i got it from one of my java books. In any case, what I'm attempting to do is integrate this chat pane into a gui that i have created. I attempted to call an instace of the Client class from my gui program so that I can use the textfield and textarea contained in my app, but it will not allow me to do it. Would I need to integrate this code into the code for my Gui class. I have a simple program that contains chat and a game. The code for the Client is listed below.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    public class Client
    extends JPanel {
    public static void main(String[] args) throws IOException {
    String name = args[0];
    String host = args[1];
    int port = Integer.parseInt(args[2]);
    final Socket s = new Socket(host, port);
    final Client c = new Client(name, s);
    JFrame f = new JFrame("Client : " + name);
    f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    c.shutDown();
    System.exit(0);
    f.setSize(300, 300);
    f.setLocation(100, 100);
    f.setContentPane(c);
    f.setVisible(true);
    private String mName;
    private JTextArea mOutputArea;
    private JTextField mInputField;
    private PrintWriter mOut;
    public Client(final String name, Socket s)
    throws IOException {
    mName = name;
    createUI();
    wireNetwork(s);
    wireEvents();
    public void shutDown() {
    mOut.println("");
    mOut.close();
    protected void createUI() {
    setLayout(new BorderLayout());
    mOutputArea = new JTextArea();
    mOutputArea.setLineWrap(true);
    mOutputArea.setEditable(false);
    add(new JScrollPane(mOutputArea), BorderLayout.CENTER);
    mInputField = new JTextField(20);
    JPanel controls = new JPanel();
    controls.add(mInputField);
    add(controls, BorderLayout.SOUTH);
    mInputField.requestFocus();
    protected void wireNetwork(Socket s) throws IOException {
    mOut = new PrintWriter(s.getOutputStream(), true);
    final String eol = System.getProperty("line.separator");
    new Listener(s.getInputStream()) {
    public void processLine(String line) {
    mOutputArea.append(line + eol);
    mOutputArea.setCaretPosition(
    mOutputArea.getDocument().getLength());
    protected void wireEvents() {
    mInputField.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    String line = mInputField.getText();
    if (line.length() == 0) return;
    mOut.println(mName + " : " + line);
    mInputField.setText("");

    Thanks for ur help!i have moved BufferedReader outside the loop. I dont think i am getting exception as i can c the output once.What i am trying to do is repeat the process which i m getting once.What my method does is first one sends the packet to multicasting group (UDP) and other method receives the packets and prints.

  • Need help with integrating chat into Gui

    Hello Guys,
    I'm fairly new to Java and I have a quick question regarding a simple chat program in java. My problem is that I have a simple chat program that runs from its own JFrame etc. Most of you are probably familiar with the code below, i got it from one of my java books. In any case, what I'm attempting to do is integrate this chat pane into a gui that i have created. I attempted to call an instace of the Client class from my gui program so that I can use the textfield and textarea contained in my app, but it will not allow me to do it. Would I need to integrate this code into the code for my Gui class. I have a simple program that contains chat and a game. The code for the Client is listed below.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    public class Client
    extends JPanel {
    public static void main(String[] args) throws IOException {
    String name = args[0];
    String host = args[1];
    int port = Integer.parseInt(args[2]);
    final Socket s = new Socket(host, port);
    final Client c = new Client(name, s);
    JFrame f = new JFrame("Client : " + name);
    f.addWindowListener(new WindowAdapter() { 
    public void windowClosing(WindowEvent we) { 
    c.shutDown();
    System.exit(0);
    f.setSize(300, 300);
    f.setLocation(100, 100);
    f.setContentPane(c);
    f.setVisible(true);
    private String mName;
    private JTextArea mOutputArea;
    private JTextField mInputField;
    private PrintWriter mOut;
    public Client(final String name, Socket s)
    throws IOException {
    mName = name;
    createUI();
    wireNetwork(s);
    wireEvents();
    public void shutDown() {
    mOut.println("");
    mOut.close();
    protected void createUI() {
    setLayout(new BorderLayout());
    mOutputArea = new JTextArea();
    mOutputArea.setLineWrap(true);
    mOutputArea.setEditable(false);
    add(new JScrollPane(mOutputArea), BorderLayout.CENTER);
    mInputField = new JTextField(20);
    JPanel controls = new JPanel();
    controls.add(mInputField);
    add(controls, BorderLayout.SOUTH);
    mInputField.requestFocus();
    protected void wireNetwork(Socket s) throws IOException {
    mOut = new PrintWriter(s.getOutputStream(), true);
    final String eol = System.getProperty("line.separator");
    new Listener(s.getInputStream()) {
    public void processLine(String line) {
    mOutputArea.append(line + eol);
    mOutputArea.setCaretPosition(
    mOutputArea.getDocument().getLength());
    protected void wireEvents() {
    mInputField.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    String line = mInputField.getText();
    if (line.length() == 0) return;
    mOut.println(mName + " : " + line);
    mInputField.setText("");

    I think the easiest way to do it would be to cut an paste most of that code into your program. Then all you have to do is change some names so that it uses your textfield and textarea.

  • Help needed with a chat program

    Hi everyone! i'm busy with a client/server chat program. I'm really stuck because i can't seem to get the messages from one client to show on the other client's screen.
    If one client sends a message to another client, the server receives the message, but the second client does not receive the message.
    Here is the server code that sends messages to the clients:
    BufferedReader incomeReader = null;
    PrintWriter outWriter = null;
    try {
         incomeReader = new BufferedReader(new InputStreamReader (incomingSocket.getInputStream()));
    outWriter = new PrintWriter(incomingSocket.getOutputStream(),true);
    }catch (Exception e) {
              System.out.println("error handling a client: " + e);
    System.exit(-1);
    line = incomeReader.readLine();
    textArea.append(line + "\n");               
    outWriter.println(line);
    The server is suppose to put the message it receives on the text area on the server screen, and then send the message to all clients connected to it.
    I hope somebody will be able to help me...

    The code posted just sends any data it receives back to the person who sent it. To get it to work there, you probably should flush after the println. I believe your mother taught you always to flush. It seems you have forgotten.

  • Both side chatting with simple GUI ,,helps pls?

    guys I'm Java application programmer i don't have well knowledge in network programing ,,my question ,,,from where should i start to design a simple GUI client*s* server chat program ,i mean some thing like simple yahoo messenger the program should include also adding contact and make that contact appears ON if he login or OFF if he sign out like red color for ON-line contact and and white color for off-line contact ...........
    another thing that chat system should include shared folder all the contact can enter it and upload file or download file ...
    please guys i run to you to help me i have 2 weeks only to do that thing please don't let me down i need your help ....TIPS,code,any thing full code :) ,,any thing will be really appreciated .
    guys for more information the program includes only the chat of course its both sides chat between the clients and these is no conference room
    or audio or video nothing ,,just text only nothing else except the folder shearing service and the colors of the contacts for login or not .
    guys once more help me give me codes or any thing useful i count on you guys.
    thx a lot in advance
    RSPCPro
    Edited by: RSPCPRO on Oct 3, 2008 6:25 PM

    RSPCPRO wrote:
    Dude , u r right ,,,but still its simple GUI issueI'm not sure why you are getting this impression. It's not a simple "GUI issue." Yes, you can simply create the GUI for this, but will it be functional? No. Furthermore, if it was so simple, why are you posting asking for help?
    For an instant message chat program, in addition to GUI programming, you need to know how client / server systems work and you need to implement one. A server should be running on one system and the client(s) will connect to it. The server usually maintains the buddy list and passes the messages to/from different clients. This presents several problems that you will need to solve:
    1. How will you develop a protocol between the client / server for communication?
    2. How will you authenticate users?
    3. How will you maintain the buddy list on the server (data structure, database, file)?
    4. How will you pass messages from one client to another (simple string message, serialized data object, etc.)?
    5. etc.
    Now, I'm not saying this is "impossible" so please don't take it that way. I'm simply trying to help you realize that there are a lot of factors to consider when developing this type of application.
    RSPCPRO wrote:
    and for the "FTP?" ,,,its folder shearing as i said earlier every one of your friends can access it not FTP .....Talking about "folder sharing" is a whole other issue. What I meant by saying "FTP?" is, how do you plan on implementing "folder sharing" remotely? One option is FTP. How would you do it?
    RSPCPRO wrote:
    and one thing please don't assume any thing u don't knowIf you ask a very broad question and ask for code, I can only assume one thing.
    RSPCPRO wrote:
    be cooler with others and u will get what u want.I agree. You should take your own advice. I'm not the one looking for help, you are.
    RSPCPRO wrote:
    thx dude for ur advice and for the link have a good day.You're welcome, and good luck.

  • GUI for chat program

    Hi everyone,
    I'm writing a simple chat program as a assignment at my Uni. I get stucked with the client GUI. I want to create a GUI like that of Yahoo messenger which has a list of connected users displayed on the GUI. When u double click on the name of the user, u will get connected to that user. I have no idea about creating a GUI list like this one. Can anybody help me with this? Thanks in advance!

    There are many tutorials on this site; check the "tutorials" link on the column on the left.
    Here are ones about GUIs:
    http://developer.java.sun.com/developer/onlineTraining/GUI/
    I'd suggest skipping over any tutorials prior to JDK 1.1 or even 1.2.
    Read more recent ones. There have been significant improvements, especially w.r.t. event handling, between 1.0 and 1.1.

  • I have a licence code for Adobe CS6 Master Collection which I'm using for more  than a year, suddeny I am in trial mode (all programs)  an it seems that this code is not accepted anymore. Help needed!!

    I have a licence code for Adobe CS6 Master Collection which I'm using for more  than a year, suddeny I am in trial mode (all programs)  an it seems that this code is not accepted anymore. Help needed!!

    Chat Now button near the bottom for Activation and Deactivation problems may help
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html

  • Help needed! Just want to cancel my year subscription. No answer from support via mail, noone answers when I call, support chat don't work.

    Help needed! Just want to cancel my year subscription. No answer from support via mail, noone answers when I call, support chat don't work.

    Hi there
    I'll pass your details to our Russian team and they'll contact you to assist further.
    Kind regards
    Bev

Maybe you are looking for

  • Scrolling problem.

    So, im on a macbook and when i open a page on safari and i scroll down, the page jumps back to the top. I have to continue scrolling down to the exact spot multiple times after it jumping back to the top before it will let me continue scrolling down

  • Problem with Data Type

    Hi, I am performing SAP Production Order Confirmations (CO11N transaction) using an xMII BLT. In the CO11N screen, SAP doesn't let you type character values in the field 'Yield'. It is the same thing in xMII BLT where I have defined 'Yield' as the Da

  • ESS - CLAIMS ERROR

    Hi One & All, Hope everyone is doing good. I have one issue when creating Claims request from ESS through Portal. When I click Create in Reimbursements / claims application, I have selected the Reimbursement type & Request type, then It is giving err

  • Wht will happen if  JMS Consumer thread gets a TMF Error

    Hi If anybody knows the implementation of various providers of JMS how they will behave , when a TMF error [ Invalid transaction / Obsolete transaction] is thrown to the Consumer thread. Consider this as the scenario. Consumer Thread starts it transa

  • Opening Aperture Library from my Drobo (Very Slow)

    I have a Firewire Drobo, which I love, and I use Aperture on my Mac. I currently have my primary Aperture Library (~125GB) on my Drobo. I have been experiencing an issue with slowness when opening my Aperture library from my Drobo. It takes several m