update
This commit is contained in:
BIN
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Cercle.class
Normal file
BIN
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Cercle.class
Normal file
Binary file not shown.
25
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Cercle.java
Normal file
25
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Cercle.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Cercle extends JComponent {
|
||||
public Color couleurCercle;
|
||||
|
||||
public Cercle(int r, int g, int b){
|
||||
this.couleurCercle = new Color(r,g,b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
Color couleurFond = this.getBackground();
|
||||
if (this.isOpaque()) {
|
||||
secondPinceau.setColor(couleurFond);
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
secondPinceau.setColor(this.couleurCercle);
|
||||
secondPinceau.fillOval(0,0, this.getWidth(), this.getHeight());
|
||||
secondPinceau.setColor(couleurFond);
|
||||
secondPinceau.fillOval(this.getWidth()/4 , this.getHeight()/4 , this.getWidth()/2 , this.getHeight()/2);
|
||||
}
|
||||
}
|
||||
25
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Cercle.java~
Normal file
25
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Cercle.java~
Normal file
@@ -0,0 +1,25 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Cercle extends JComponent {
|
||||
public Color couleurCercle;
|
||||
|
||||
public Cercle(int r, int g, int b){
|
||||
this.couleurCercle = new Color(r,g,b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
Color couleurFond = this.getBackground()
|
||||
if (this.isOpaque()) {
|
||||
secondPinceau.setColor(couleurFond);
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
secondPinceau.setColor(this.couleurCercle);
|
||||
secondPinceau.fillOval(0,0, this.getWidth(), this.getHeight());
|
||||
secondPinceau.setColor(couleurFond);
|
||||
secondPinceau.fillOval(this.getWidth()/4 , this.getHeight()/4 , 3*this.getWidth()/4 , 3*this.getHeight()/4);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Q4Main.class
Normal file
BIN
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Q4Main.class
Normal file
Binary file not shown.
28
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Q4Main.java
Normal file
28
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Q4Main.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Q4Main{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout grille = new GridLayout(5,5);
|
||||
fenetre.setLayout(grille);
|
||||
|
||||
Cercle[][] tabCercle = new Cercle[5][5];
|
||||
int vert = 0;
|
||||
for (Cercle[] ligne : tabCercle){
|
||||
int bleu = 25;
|
||||
vert += 50;
|
||||
for (Cercle cercle : ligne){
|
||||
cercle = new Cercle(0,vert,bleu);
|
||||
fenetre.add(cercle);
|
||||
bleu += 50;
|
||||
}
|
||||
}
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
16
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Q4Main.java~
Normal file
16
DEV/DEV2.1/TP06_Dessin/Q4_Cercles/Q4Main.java~
Normal file
@@ -0,0 +1,16 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Q1_Formes{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Cercle[][] listeCercle = new Cercle[25];
|
||||
fenetre.add(lesDessins);
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user