APL/APL2.1/TP11/Playlist/Playlist.java

44 lines
996 B
Java
Raw Normal View History

2022-03-28 17:27:59 +02:00
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Playlist extends JPanel implements MouseListener {
private JLabel prevSelection;
private JLabel prevHover;
public void mouseClicked(MouseEvent evenement) {
JLabel raiser = evenement.getComponent();
raiser.setBackground(new Color(0, 150, 255));
if (prevSelection != null) {
prevSelection.setBackground(new Color(255, 255, 255));
}
}
public void mouseEntered(MouseEvent evenement) {
}
public void mouseExited(MouseEvent evenement) {
}
public void mousePressed(MouseEvent evenement) {}
public void mouseReleased(MouseEvent evenement) {}
@Override
public void paintComponent(Graphics brush) {
}
public Playlist() {
super();
}
public void add(String title) {
JLabel l = new JLabel(title);
l.addMouseListener(this);
l.setOpaque(true);
this.add(l);
}
}