cm1
This commit is contained in:
Binary file not shown.
@@ -3,22 +3,32 @@ import java.awt.*;
|
|||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
public class Playlist extends JFrame implements MouseListener {
|
public class Playlist extends JFrame implements MouseListener {
|
||||||
|
private JLabel etiquette;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
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();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
this.setBackground(Color.CYAN);
|
JLabel label = (JLabel) e.getComponent();
|
||||||
|
label.setBackground(Color.CYAN);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
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();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user