2022-03-28 17:27:59 +02:00
|
|
|
import java.awt.*;
|
|
|
|
import java.awt.event.*;
|
|
|
|
import javax.swing.*;
|
|
|
|
|
2022-04-12 17:16:22 +02:00
|
|
|
public class Playlist extends JPanel {
|
|
|
|
private int elementCount;
|
|
|
|
private Observer obs;
|
2022-03-28 17:27:59 +02:00
|
|
|
|
|
|
|
public Playlist() {
|
|
|
|
super();
|
2022-04-12 17:16:22 +02:00
|
|
|
elementCount = 0;
|
|
|
|
obs = new Observer();
|
2022-03-28 17:27:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void add(String title) {
|
2022-04-12 17:16:22 +02:00
|
|
|
elementCount += 1;
|
|
|
|
this.setLayout(new GridLayout(elementCount, 1));
|
|
|
|
|
2022-03-28 17:27:59 +02:00
|
|
|
JLabel l = new JLabel(title);
|
2022-04-12 17:16:22 +02:00
|
|
|
l.addMouseListener(obs);
|
2022-03-28 17:27:59 +02:00
|
|
|
l.setOpaque(true);
|
|
|
|
this.add(l);
|
|
|
|
}
|
|
|
|
}
|