cm1
This commit is contained in:
@@ -3,22 +3,32 @@ import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Playlist extends JFrame implements MouseListener {
|
||||
private JLabel etiquette;
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
this.setBackground(Color.LIGHT_GRAY);
|
||||
JLabel label = (JLabel) e.getComponent();
|
||||
label.setBackground(Color.LIGHT_GRAY);
|
||||
this.etiquette.setBackground(Color.WHITE);
|
||||
this.etiquette = label;
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
this.setBackground(Color.CYAN);
|
||||
JLabel label = (JLabel) e.getComponent();
|
||||
label.setBackground(Color.CYAN);
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
this.setBackground(Color.WHITE);
|
||||
JLabel label = (JLabel) e.getComponent();
|
||||
if (this.etiquette != label){
|
||||
label.setBackground(Color.WHITE);
|
||||
}else if (this.etiquette == label){
|
||||
label.setBackground(Color.LIGHT_GRAY);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user