TP
This commit is contained in:
30
DEV2.1/TP09/01_Volume/Cercle.java
Normal file
30
DEV2.1/TP09/01_Volume/Cercle.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Cercle extends JComponent {
|
||||
|
||||
private Color fond;
|
||||
|
||||
public Cercle(Color fond) {
|
||||
this.fond = fond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
|
||||
if (this.isOpaque()) {
|
||||
pinceau.setColor(this.getBackground());
|
||||
pinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
pinceau.setColor(Color.DARK_GRAY);
|
||||
pinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
pinceau.setColor(this.fond);
|
||||
pinceau.fillOval(this.getWidth()/4, this.getHeight()/4, this.getWidth()/2, this.getHeight()/2);
|
||||
}
|
||||
|
||||
public void setFond(Color n) {
|
||||
this.fond = n;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user