Commit 4c6214ae authored by 9531304's avatar 9531304

bad graphic

parents
Pipeline #635 failed with stages
import javax.swing.*;
import java.awt.*;
public class ChatArea extends JTextArea {
private static final int rows = 10 , columns = 30;
private static String user = null;
private static String message = null;
public ChatArea() {
super(rows , columns);
this.setEditable(false);
this.setLineWrap(true);
this.setLayout(new BorderLayout());
JLabel user = new JLabel(this.user);
this.add(user , BorderLayout.LINE_START);
JLabel message = new JLabel(this.message);
this.add(message , BorderLayout.CENTER);
}
public void addMessage(String name , String message){
this.user = name;
this.message = message;
}
}
import javax.swing.*;
public class ChatButton extends JButton {
private final String Text = "Send Massage";
public ChatButton() {
super();
this.setText(Text);
}
}
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;
public ChatRoomGUI() {
super();
this.setTitle(WINDOWS_TITLE);
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(WIDTH ,HEIGHT);
this.setLocation(x , y);
JTextArea jta = new JTextArea("UserName:");
jta.setEditable(true);
this.add(jta , BorderLayout.PAGE_START);
JButton jb = new JButton();
jb.setText("Confirm");
this.add(jb , BorderLayout.PAGE_END);
this.setVisible(true);
}
}
import javax.swing.*;
public class chatText extends JTextArea {
public chatText(){
super();
this.setEditable(true);
this.setText("Type here...");
}
}
import javax.swing.*;
import java.awt.*;
public class frame1 extends JFrame {
private final String windows_label = "AUT Chat GUI";
private final int WIDTH = 500 , HEIGTH = 500;
private final int x = 600 , y = 100;
ChatArea jta;
ChatButton jb;
panel p1 = new panel();
ChatArea ca = new ChatArea();
panel2 p2 = new panel2();
public frame1() {
super();
this.setTitle(windows_label);
this.setLayout(new BorderLayout());
this.setSize(WIDTH , HEIGTH);
this.setLocation(x , y);
this.add(p1 , BorderLayout.PAGE_END);
this.add(ca , BorderLayout.LINE_END);
this.add(p2 , BorderLayout.LINE_START);
this.setVisible(true);
}
}
public class lab10 {
public static void main(String[] args) {
new ChatRoomGUI();
ChatArea ca = new ChatArea();
ca.addMessage("karim" , "salam be hame");
new frame1();
}
}
import javax.swing.*;
import java.awt.*;
public class panel extends JPanel {
chatText ct = new chatText();
ChatButton cb = new ChatButton();
public panel() {
this.setLayout(new GridLayout(1 , 2));
this.add(ct);
this.add(cb);
}
}
import org.w3c.dom.Text;
import javax.swing.*;
import java.awt.*;
public class panel2 extends JPanel {
public panel2(){
this.setLayout(new GridLayout(20 , 1));
JLabel t1 = new JLabel("amir");
this.add(t1);
JLabel t2 = new JLabel("reza");
this.add(t2);
JLabel t3 = new JLabel("Morteza");
this.add(t3);
}
}
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