Developpement/23DEV1.1/TPS2/TP01/Evènements/Evènement2/Playlist.java

35 lines
870 B
Java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;
public class Playlist extends JComponent implements MouseWheelListener
{
int n = 0;
int x = 70;
protected void paintComponent(Graphics pinceau)
{
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.drawRect(0, 0, getWidth(), getHeight());
}
for(int i = 0 ; i <10 ; i++)
{
secondPinceau.setColor(Color.GRAY);
secondPinceau.fillOval(x+10, 130, 70, 70);
x = x+90;
}
for(int i = 0 ; i <n ; i++)
{
secondPinceau.setColor(Color.YELLOW);
secondPinceau.fillOval(x+10, 130, 70, 70);
x = x+90;
}
}
public Playlist(){
super();
}
}