Commit ecfc3940 authored by 9731065's avatar 9731065

2 classes created

parent ccbfcac2
Pipeline #650 canceled with stages
import javax.swing.*;
import java.awt.*;
public class ChatArea extends JTextArea {
private static final int ROWS = 10, COLUMNS = 30;
public ChatArea() {
super(ROWS, COLUMNS);
this.setEditable(false);
this.setLineWrap(true);
this.setBackground(Color.pink);
}
public void addMessage(String username , String userPost){
setLayout(new BorderLayout());
insert(" " + username + " _"+userPost , 0 );
}
}
public class ChatRoomGUI { import javax.swing.*;
import java.awt.*;
public class ChatRoomGUI extends JFrame {
private final String WINDOWS_TITLE = "Aut Chat Room";
private final int WIDTH = 500 , HEIGHT = 500 ;
private final int X = 100 , Y = 100 ;
private MessageArea messageArea;
private ChatArea chatBox;
private ParticipantsArea participantsArea;
public ChatRoomGUI(){
super();
this.setTitle(WINDOWS_TITLE);
this.setLayout(new BorderLayout());
ChatArea chatBox = new ChatArea();
this.add(new JScrollPane(chatBox), BorderLayout.CENTER);
MessageArea messageArea = new MessageArea();
this.add(messageArea , BorderLayout.SOUTH);
participantsArea = new ParticipantsArea();
this.add(participantsArea , BorderLayout.WEST);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(WIDTH,HEIGHT);
this.setLocation(X,Y);
this.setVisible(true);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment