import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;


public class Volume extends JComponent implements MouseWheelListener
{
  int x = 0;
  int nbrClic = 0;
	protected void paintComponent(Graphics pinceau) 
	{
      Graphics secondPinceau = pinceau.create();
      secondPinceau.setColor(Color.DARK_GRAY);
      secondPinceau.fillRect(0,0,this.getWidth(), this.getHeight());
      for(int i = 0 ; i < 10 ; i++)
      {
        secondPinceau.setColor(Color.GRAY);
        secondPinceau.fillOval(x, 50, 70, 70);
        x = x+60;
      }
      for(int i = 0 ; i < this.nbrClic ; i++)
      {
        secondPinceau.setColor(Color.YELLOW);
        secondPinceau.fillOval(x, 50, 70, 70);
        x = x+60;
      }
    }
	public void mouseWheelMoved(MouseWheelEvent evenement)
	{
    this.nbrClic = evenement.getWheelRotation();
    this.repaint();
    if(this.nbrClic>=10){
        nbrClic++;
    }
    if(this.nbrClic<=0){
        nbrClic--;
    }
	}
  public Volume(){
    super();
  }
}