TP
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Etoile implements ProducteurDePoints {
|
||||
public class Etoile implements ProducteurDePoints extends JComponent {
|
||||
private static final int xCentre = 100;
|
||||
private static final int yCentre = 100;
|
||||
private static final double rayon = 90.0;
|
||||
@@ -24,7 +25,22 @@ public class Etoile implements ProducteurDePoints {
|
||||
return p;
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
secondPinceau.drawRect();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(300, 300);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setVisible(true);
|
||||
Etoile e = new Etoile();
|
||||
while (e.suivant() != null) {
|
||||
// TODO
|
||||
|
@@ -1,5 +1,4 @@
|
||||
public interface Vehicule {
|
||||
|
||||
public String sorte();
|
||||
|
||||
public int nbRoues();
|
||||
|
Reference in New Issue
Block a user