update
This commit is contained in:
27
DEV.2.1/CM1/ex3/Compteurs.java
Normal file
27
DEV.2.1/CM1/ex3/Compteurs.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Compteurs extends JComponent {
|
||||
|
||||
private Image img;
|
||||
|
||||
public Compteurs() {
|
||||
super();
|
||||
this.img = Toolkit.getDefaultToolkit().getImage("img.png");
|
||||
}
|
||||
|
||||
@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.setColor(this.getForeground());
|
||||
|
||||
secondPinceau.drawImage(this.img, this.getWidth()/2, this.getHeight()/2, this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user