AWT and Swing. Not really popular in mainstream GUI design. But can be really helpful in learning the MVC architecture and building small interfaces.
Model, View, Controller.
“It divides a given application into three interconnected parts in order to separate internal representations of information from the ways that information is presented to and accepted from the user.The MVC design pattern decouples these major components allowing for efficient code reuse and parallel development.”
—- “Model-view-controller” from Wikipedia
Frame includes the title and menu bars or other optional buttons and textfields.
Panel is the main area where textfields, buttons etc.
Set up the connection with address and port number. Listen to the response from client. Once the setup is finished and ServerSocket accept(), the control power is transferred to Socket.
The actual role for communication between client and server.
- Setup ServerSocket with port number.
- accept() returns a Socket
- Initiate a client Socket
- Use Socket.getOutputStream/getInputStream
Basic structure of client:
- Open a socket.
- Open an input stream and output stream to the socket.
- Read from and write to the stream according to the server’s protocol.
- Close the streams.
- Close the socket.