Controle machine
This commit is contained in:
19
DEV2.1/CM1/03_Compteur/Six.java
Normal file
19
DEV2.1/CM1/03_Compteur/Six.java
Normal file
@@ -0,0 +1,19 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Six extends JComponent {
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
|
||||
if (this.isOpaque()) {
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
Image img = Toolkit.getDefaultToolkit().getImage("6.png");
|
||||
// On place l'image au milieu de son composant puis on soustrait par la moitié des dimensions de l'image (55x80)
|
||||
secondPinceau.drawImage(img, this.getWidth()/2 - 27 , this.getHeight()/2 - 40, this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user