import javax.swing.*; 
import java.awt.*; 

public class Volume extends JComponent {
    private int niveau = 5;

	public Volume() {
		super();
	}

    public setNiveau(int newNiveau) {
        if (newNiveau < 0) {
            this.niveau = 0;
        } else if (newNiveau > 10) {
            this.niveau = 10;
        } else {
            this.niveau = newNiveau;
        }
        repaint();
    }

    public int getNiveau() {
        return this.niveau;
    }
    
	@Override
    protected void paintComponent(Graphics pinceau) {
        Graphics secondPinceau = pinceau.create();
        if (this.isOpaque()){
            secondPinceau.setColor(this.getBackground);
            secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
        }
        secondPinceau.setBackground(Color.BLUE);
    }

}