This commit is contained in:
Moncef STITI 2024-03-05 16:24:56 +01:00
parent 77aea5b825
commit 9de7f66a8d
14 changed files with 45 additions and 29 deletions

View File

@ -18,4 +18,9 @@ public class Exemple{
System.out.println(f);
}
}
}
public class Controleur extends MouseAdapter
implements MouseMotionListener, ActionListener{
...
}

View File

@ -7,7 +7,7 @@ public class exo4 {
JFrame fenetre = new JFrame();
// on configure la fenetre
fenetre.setPreferredSize(1200, 1000);
fenetre.setSize(1200, 1000);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,28 +1 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Fond Attente ActionListener {
static JPanel panneau;
public static void main(String[] args) {
JFrame fenetre = new JFrame("Fond");
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setSize(500, 500);
JPanel panneau = new JPanel();
fenetre.add(panneau);
fenetre.setVisible(true);
}
}
try {
int n = Integer.parseInt(args[0]);
System.out.println("En hexadecimal" + Integer.toHexString(n));
}catch(NumberFormatException e){
System.err.println("Ceci n'est pas un" + "entier !");
} catch(ArrayIndexOutOfBoundsException e){
System.err.println("Il faut un argument :");
}
// A faire

Binary file not shown.

View File

@ -0,0 +1,26 @@
import javax.swing.*;
import java.awt.*;
public class Dessin extends JComponent {
private Image imageDeCercle;
public Dessin() {
super();
}
// Méthode pour dessiner sur le composant
@Override
protected void paintComponent(Graphics pinceau) {
// Obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard
Graphics secondPinceau = pinceau.create();
// Obligatoire : si le composant n'est pas censé être transparent
if (this.isOpaque()) {
// Obligatoire : on repeint toute la surface avec la couleur de fond
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.setColor(new Color(30,255,30));
secondPinceau.fillArc(20, 95, 50, 50, 0, 360);
}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
import javax.swing.*;
import java.awt.*;
public class Disque extends Dessin {
public Disque(){
// Maintenant on dessine ce que l'on veut
super();
Graphics secondPinceau = getGraphics();
secondPinceau.setColor(new Color(30,255,30));
secondPinceau.fillArc(20, 95, 50, 50, 0, 360);
}
}