update
This commit is contained in:
@@ -2,20 +2,35 @@ 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();
|
||||
this.setColor(this.getForeground());
|
||||
|
||||
this.setBackground(new Color(255,30,255));
|
||||
|
||||
this.setColor(Color.GRAY);
|
||||
this.fillOval(10, 70, 100, 100);
|
||||
if (this.isOpaque()){
|
||||
secondPinceau.setColor(this.getBackground);
|
||||
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
|
||||
}
|
||||
secondPinceau.setBackground(Color.BLUE);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user