diff --git a/DEV2.1/TP06/Accueil.class b/DEV2.1/TP06/Accueil.class new file mode 100644 index 0000000..c12630e Binary files /dev/null and b/DEV2.1/TP06/Accueil.class differ diff --git a/DEV2.1/TP06/Accueil.java b/DEV2.1/TP06/Accueil.java new file mode 100644 index 0000000..d88c476 --- /dev/null +++ b/DEV2.1/TP06/Accueil.java @@ -0,0 +1,55 @@ +import java.awt.*; +import javax.swing.*; + +public class Accueil extends JComponent { + @Override + public 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()); + } + + // Logo + Image logo = Toolkit.getDefaultToolkit().getImage("logo.png"); + secondPinceau.drawImage(logo, 10, 30,this); + + // Texte Logo + Font police = new Font("URW Gothic", Font.BOLD,30); + secondPinceau.setFont(police); + secondPinceau.setColor(Color.WHITE); + secondPinceau.drawString("IUT",35,40); + + // Texte titre + police = new Font("URW Gothic", Font.BOLD, 23); + secondPinceau.setFont(police); + secondPinceau.drawString("Département",112,35); + secondPinceau.drawString("informatique",118,60); + + // Texte login/pswd + secondPinceau.drawString("login",64,100); + secondPinceau.drawString("password", 15, 130); + + // Les TextFields sont directement ajoutés à la fenêtre + JTextField login = new JTextField(); + JTextField password = new JTextField(); + login.setBounds(130,82,120,20); + password.setBounds(130,112,120,20); + this.add(login); + this.add(password); + } + + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + Accueil menu = new Accueil(); + fenetre.setSize(278,183); + fenetre.setLocation(100,100); + fenetre.getContentPane().setBackground(new Color(156,120,200)); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.add(menu); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP06/Formes.class b/DEV2.1/TP06/Formes.class index a0da33c..3c455a3 100644 Binary files a/DEV2.1/TP06/Formes.class and b/DEV2.1/TP06/Formes.class differ diff --git a/DEV2.1/TP06/Formes.java b/DEV2.1/TP06/Formes.java index 9a8f407..465d8d9 100644 --- a/DEV2.1/TP06/Formes.java +++ b/DEV2.1/TP06/Formes.java @@ -3,13 +3,6 @@ import java.awt.*; public class Formes extends JComponent { - private String typeComposant; - - public Formes(String typeComposant) { - super(); - this.typeComposant = typeComposant; - } - @Override protected void paintComponent(Graphics pinceau) { // obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard @@ -21,22 +14,30 @@ public class Formes extends JComponent { secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); } - if (this.typeComposant == "Carre") { - secondPinceau.setColor(new Color(51,153,255)); - secondPinceau.fillRect(0, 0, 50, 50); - secondPinceau.setColor(Color.BLUE); - secondPinceau.drawRect(0,0,50,50); - } + // Carré + secondPinceau.setColor(new Color(51,153,255)); + secondPinceau.fillRect(100, 100, 50, 50); + secondPinceau.setColor(Color.BLUE); + secondPinceau.drawRect(100,100,50,50); - if (this.typeComposant == "Disque") { - // TODO - } + // Disque + secondPinceau.setColor(Color.GREEN); + secondPinceau.drawOval(175,100,25,25); + // Texte + secondPinceau.setColor(new Color(80, 00, 80)); + Font police = new Font("Arial", Font.BOLD, 24); + secondPinceau.setFont(police); + secondPinceau.drawString(">o<", 100, 200); + + // Image + Image logo = Toolkit.getDefaultToolkit().getImage("logo.png"); + secondPinceau.drawImage(logo, 175, 175, this); } public static void main(String[] args) { JFrame fenetre = new JFrame(); - Formes test = new Formes("Carre"); + Formes test = new Formes(); // on configure la fenetre fenetre.setSize(500, 500); fenetre.setLocation(0, 0); diff --git a/DEV2.1/TP06/GFG.class b/DEV2.1/TP06/GFG.class new file mode 100644 index 0000000..c1fa487 Binary files /dev/null and b/DEV2.1/TP06/GFG.class differ diff --git a/DEV2.1/TP06/Main.java b/DEV2.1/TP06/Main.java new file mode 100644 index 0000000..1244737 --- /dev/null +++ b/DEV2.1/TP06/Main.java @@ -0,0 +1,12 @@ +public class Main { + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + Sautoir test = new Sautoir(); + // on configure la fenetre + fenetre.setSize(500, 500); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.add(test); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP06/Sautoir.class b/DEV2.1/TP06/Sautoir.class new file mode 100644 index 0000000..937cc65 Binary files /dev/null and b/DEV2.1/TP06/Sautoir.class differ diff --git a/DEV2.1/TP06/Sautoir.java b/DEV2.1/TP06/Sautoir.java new file mode 100644 index 0000000..ae72164 --- /dev/null +++ b/DEV2.1/TP06/Sautoir.java @@ -0,0 +1,38 @@ +import java.awt.*; +import javax.swing.*; + +public class Sautoir extends JComponent { + + @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()); + } + + int[] coord_x = {0, this.getWidth(), 0, this.getWidth()}; + int[] coord_y = {0, 0, this.getHeight(), this.getHeight()}; + Polygon p = new Polygon(coord_x, coord_y, 4); + secondPinceau.setColor(Color.CYAN); + secondPinceau.fillPolygon(p); + + } + + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + GridLayout layout = new GridLayout(5, 5); + // on configure la fenetre + fenetre.setSize(250, 250); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.setLayout(layout); + for (int i = 0; i != 25; i++) { + fenetre.add(new Sautoir()); + } + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP06/login.jpg b/DEV2.1/TP06/login.jpg new file mode 100644 index 0000000..139f222 Binary files /dev/null and b/DEV2.1/TP06/login.jpg differ diff --git a/DEV2.1/TP06/logo.png b/DEV2.1/TP06/logo.png new file mode 100644 index 0000000..4713bcc Binary files /dev/null and b/DEV2.1/TP06/logo.png differ