24 lines
514 B
Java
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);
|
|
}
|
|
} |