APL/APL2.1/TP11/Playlist/Playlist.java
2022-04-12 17:16:22 +02:00

24 lines
514 B
Java

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Playlist extends JPanel {
private int elementCount;
private Observer obs;
public Playlist() {
super();
elementCount = 0;
obs = new Observer();
}
public void add(String title) {
elementCount += 1;
this.setLayout(new GridLayout(elementCount, 1));
JLabel l = new JLabel(title);
l.addMouseListener(obs);
l.setOpaque(true);
this.add(l);
}
}