Coding Fun Java Intermediate Java Tutorial – 50 – Creating the GUI for the Client

Intermediate Java Tutorial – 50 – Creating the GUI for the Client





Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

23 thoughts on “Intermediate Java Tutorial – 50 – Creating the GUI for the Client”

  1. I get an error message on getActionCommand()… :/

  2. Hamid reza says:

    im getting undefined methods for
    super("client mofo");
    add();
    setSize();
    setVisible();

    i imported everything bucky did and i dont see any differences between our codes so i dont know whats wrong
    here's my full code

    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;

    public class Client {

    private JTextField userText;
    private JTextArea chatWindow;
    private ObjectOutputStream output;
    private ObjectInputStream input;
    private String message = "";
    private String serverIP;
    private Socket connection;

    //constructor
    public Client (String host) {
    super ("client mofo");
    serverIP = host;
    userText = new JTextField();
    userText.setEditable(false);
    userText.addActionListener(
    new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    sendData(event.getActionCommand());
    userText.setText("");
    }
    }
    );

    add(userText, BorderLayout.NORTH);
    chatWindow = new JTextArea();
    add(new JScrollPane(chatWindow), BorderLayout.CENTER);
    setSize(300,150);
    setVisible(true);

    }
    }

  3. Keith Scull says:

    QUESTION: I have rented a remote virtual connection to a server via Amazon Web Services, using their "EC2" service and am connecting to it remotely.

    My question is, where do I go from here to publicly deploy this?
    Is the idea that the server side application runs on that remote computer, and all client apps run on, well other computers?

  4. Amit Kr Das says:

    Ok why do you use evt.getActionCommand() instead of userText.getText()….. just asking….

  5. michieb1231 says:

    can you make it so that you see the ip addres of the client that connected

  6. Colin Mulder says:

    Having a little trouble with lines 26-32. The "UsetText" command on line 27 isn't blue and having error with the closing bracket on line 30 along with the "add(userText, BroderLayout.NORTH)" on line 32. Any idea's on why and how o fix it?

  7. roeir says:

    where can i get the source code?

  8. Daniel K says:

    Crazy how little people have survived all these Java tutorials! :O

  9. Games. says:

    for some reason I always write BorderLAyout.POSITION

  10. Games. says:

    can't you make a private constructor

  11. Games. says:

    can you also make a server for only a
    LAN or MAN connection (socket)

  12. ParisfujaMC says:

    One reason why you shouldn't use the same stuff as server in parts: Hackers could figure your server and use it to hack client.

  13. MrManGames says:

    it wont let me use event.getActionCommand() inside if statements or use it in a method with if statements. PLEASE HELP BUCKY!

  14. Will this program display the users name when they chat?
    Or will it display a ip address as the user?

  15. Khan Irfan says:

    i have a question …. when 2 people talk to each other are they both CLIENTS… i dnt wana sound dumb i i have to get this question out of my system … plz reply

  16. Tarrjue says:

    Bucky, let's say I want some of my friends to connect to my server part of the program when we are all on the same internet connection (including the server). How would i set that up? Would I still need a web server?

  17. dfsfklsj says:

    Hey bucky, are you partnered with youtube? You definitely deserve some ad revenue 🙂

  18. but if you go through it twice it will stick in your head more

  19. Rahul says:

    copy past some stuff for server it will save ur time

Leave a Reply

Your email address will not be published. Required fields are marked *