TP-programmation-orientee-o.../TP13/VueChat.java
2023-06-20 21:02:09 +02:00

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
}