33 lines
602 B
Java
33 lines
602 B
Java
import java.util.Observable;
|
|
import java.util.Observer;
|
|
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
public class VueChat extends JTextArea implements Observer {
|
|
|
|
// ATTRIBUTS
|
|
|
|
private Chat chat;
|
|
|
|
// CONSTRUCTEURS
|
|
|
|
public VueChat(Chat chat) {
|
|
super(40,40);
|
|
this.setEditable(false);
|
|
this.chat = chat;
|
|
this.setFont(this.getFont().deriveFont(20));
|
|
|
|
chat.addObserver(new Observer(){
|
|
public void update(Observable obs , Object obj) {
|
|
chat.ajouter(obj);
|
|
}}
|
|
);
|
|
}
|
|
|
|
// MÉTHODES
|
|
|
|
|
|
|
|
}
|