diff --git a/APL2.1/TP07/Accueil/Accueil.class b/APL2.1/TP07/Accueil/Accueil.class new file mode 100644 index 0000000..cb37108 Binary files /dev/null and b/APL2.1/TP07/Accueil/Accueil.class differ diff --git a/APL2.1/TP07/Accueil/Accueil.java b/APL2.1/TP07/Accueil/Accueil.java new file mode 100644 index 0000000..82c2e7e --- /dev/null +++ b/APL2.1/TP07/Accueil/Accueil.java @@ -0,0 +1,32 @@ +import javax.swing.*; +import java.awt.*; + +public class Accueil { + public static void main(String[] args) { + JFrame f = new JFrame("Accueil"); + f.setSize(285, 200); + f.setLocation(100, 100); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setLayout(null); + + LoginScreen login = new LoginScreen(); + login.setLocation(0, 0); + login.setSize(278, 183); + f.add(login); + + JTextField loginLabel = new JTextField(); + loginLabel.setBackground(new Color(0, 0, 0, 0)); + loginLabel.setLocation(100, 90); + loginLabel.setSize(170, 30); + f.add(loginLabel); + + JTextField passLabel = new JTextField(); + passLabel.setBackground(new Color(0, 0, 0, 0)); + passLabel.setLocation(100, 130); + passLabel.setSize(170, 30); + f.add(passLabel); + + f.setResizable(false); + f.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Accueil/LoginScreen.class b/APL2.1/TP07/Accueil/LoginScreen.class new file mode 100644 index 0000000..075f9b3 Binary files /dev/null and b/APL2.1/TP07/Accueil/LoginScreen.class differ diff --git a/APL2.1/TP07/Accueil/LoginScreen.java b/APL2.1/TP07/Accueil/LoginScreen.java new file mode 100644 index 0000000..3ddf9d5 --- /dev/null +++ b/APL2.1/TP07/Accueil/LoginScreen.java @@ -0,0 +1,22 @@ +import javax.swing.*; +import java.awt.*; + +public class LoginScreen extends JComponent { + private Image login; + public LoginScreen() { + super(); + this.login = Toolkit.getDefaultToolkit().getImage("login.jpg"); + } + + @Override + protected void paintComponent(Graphics brush) { + Graphics newBrush = brush.create(); + + if (this.isOpaque()) { + newBrush.setColor(this.getBackground()); + newBrush.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + newBrush.drawImage(this.login, 0, 0, this); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Accueil/login.jpg b/APL2.1/TP07/Accueil/login.jpg new file mode 100644 index 0000000..139f222 Binary files /dev/null and b/APL2.1/TP07/Accueil/login.jpg differ diff --git a/APL2.1/TP07/Cercles/Cercles.class b/APL2.1/TP07/Cercles/Cercles.class new file mode 100644 index 0000000..5ca7979 Binary files /dev/null and b/APL2.1/TP07/Cercles/Cercles.class differ diff --git a/APL2.1/TP07/Cercles/Cercles.java b/APL2.1/TP07/Cercles/Cercles.java new file mode 100644 index 0000000..c42f398 --- /dev/null +++ b/APL2.1/TP07/Cercles/Cercles.java @@ -0,0 +1,20 @@ +import javax.swing.*; +import java.awt.*; + +public class Cercles { + public static void main(String[] args) { + JFrame f = new JFrame("Cercles"); + f.setSize(500, 500); + f.setLocation(100, 100); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setLayout(null); + + Circles c = new Circles(); + c.setSize(485, 460); + c.setLocation(0, 0); + f.add(c); + + f.setResizable(false); + f.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Cercles/Circles.class b/APL2.1/TP07/Cercles/Circles.class new file mode 100644 index 0000000..bb63cc3 Binary files /dev/null and b/APL2.1/TP07/Cercles/Circles.class differ diff --git a/APL2.1/TP07/Cercles/Circles.java b/APL2.1/TP07/Cercles/Circles.java new file mode 100644 index 0000000..6c5868b --- /dev/null +++ b/APL2.1/TP07/Cercles/Circles.java @@ -0,0 +1,31 @@ +import javax.swing.*; +import java.awt.*; + +public class Circles extends JComponent { + public Circles() { + super(); + } + + @Override + protected void paintComponent(Graphics brush) { + Graphics newBrush = brush.create(); + + if (this.isOpaque()) { + newBrush.setColor(this.getBackground()); + newBrush.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + for (int x = 0; x < 5; x++) { + for (int y = 0; y < 5; y++) { + Color c = new Color(0, 70 + 37 * y, 70 + 37 * x); + int sizeX = getWidth() / 5; + int sizeY = getHeight() / 5; + + newBrush.setColor(c); + newBrush.fillOval(sizeX * x, sizeY * y, sizeX, sizeY); + newBrush.setColor(Color.WHITE); + newBrush.fillOval(sizeX * x + sizeX / 4, sizeY * y + sizeY / 4, sizeX / 2, sizeY / 2); + } + } + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Formes/Formes.class b/APL2.1/TP07/Formes/Formes.class index 652357d..099268c 100644 Binary files a/APL2.1/TP07/Formes/Formes.class and b/APL2.1/TP07/Formes/Formes.class differ diff --git a/APL2.1/TP07/Formes/Formes.java b/APL2.1/TP07/Formes/Formes.java index 3a7287f..892517e 100644 --- a/APL2.1/TP07/Formes/Formes.java +++ b/APL2.1/TP07/Formes/Formes.java @@ -1,25 +1,6 @@ import javax.swing.*; import java.awt.*; -class NewJFrame extends JComponent { - public NewJFrame() { - super(); - } - - @Override - protected void paintComponent(Graphics brush) { - Graphics newBrush = brush.create(); - - if (this.isOpaque()) { - newBrush.setColor(this.getBackground()); - newBrush.fillRect(0, 0, this.getWidth(), this.getHeight()); - } - - newBrush.setColor(this.getForeground()); - - } -} - public class Formes { public static void main(String[] args) { JFrame f = new JFrame("Formes"); @@ -27,6 +8,8 @@ public class Formes { f.setLocation(100, 100); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.add(new NewPanel()); + f.setVisible(true); } } \ No newline at end of file diff --git a/APL2.1/TP07/Formes/NewJFrame.class b/APL2.1/TP07/Formes/NewJFrame.class deleted file mode 100644 index 5d73855..0000000 Binary files a/APL2.1/TP07/Formes/NewJFrame.class and /dev/null differ diff --git a/APL2.1/TP07/Formes/NewPanel.class b/APL2.1/TP07/Formes/NewPanel.class new file mode 100644 index 0000000..11626ac Binary files /dev/null and b/APL2.1/TP07/Formes/NewPanel.class differ diff --git a/APL2.1/TP07/Formes/NewPanel.java b/APL2.1/TP07/Formes/NewPanel.java new file mode 100644 index 0000000..27a87fc --- /dev/null +++ b/APL2.1/TP07/Formes/NewPanel.java @@ -0,0 +1,29 @@ +import javax.swing.*; +import java.awt.*; + +public class NewPanel extends JComponent { + private Image circles; + + public NewPanel() { + super(); + + this.circles = Toolkit.getDefaultToolkit().getImage("cercles.png"); + } + + @Override + protected void paintComponent(Graphics brush) { + Graphics newBrush = brush.create(); + + if (this.isOpaque()) { + newBrush.setColor(this.getBackground()); + newBrush.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + newBrush.setColor(Color.BLUE); + newBrush.drawRect(10, 10, 50, 50); + newBrush.drawImage(this.circles, 150, 50, this); + newBrush.setColor(Color.MAGENTA); + newBrush.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 24)); + newBrush.drawString(">o<", 150, 50); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Sautoir/Sablier.class b/APL2.1/TP07/Sautoir/Sablier.class new file mode 100644 index 0000000..7f9d0c2 Binary files /dev/null and b/APL2.1/TP07/Sautoir/Sablier.class differ diff --git a/APL2.1/TP07/Sautoir/Sablier.java b/APL2.1/TP07/Sautoir/Sablier.java new file mode 100644 index 0000000..d3a6a35 --- /dev/null +++ b/APL2.1/TP07/Sautoir/Sablier.java @@ -0,0 +1,29 @@ +import javax.swing.*; +import java.awt.*; + +public class Sablier extends JComponent { + public Sablier() { + super(); + } + + @Override + protected void paintComponent(Graphics brush) { + Graphics newBrush = brush.create(); + + if (this.isOpaque()) { + newBrush.setColor(this.getBackground()); + newBrush.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + newBrush.setColor(Color.CYAN); + + int[] x1 = {0, getWidth(), getWidth() / 2}; + int[] y1 = {0, 0, getHeight() / 2}; + + int[] x2 = {0, getWidth(), getWidth() / 2}; + int[] y2 = {getHeight(), getHeight(), getHeight() / 2}; + + newBrush.fillPolygon(x1, y1, 3); + newBrush.fillPolygon(x2, y2, 3); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Sautoir/Sautoir.class b/APL2.1/TP07/Sautoir/Sautoir.class new file mode 100644 index 0000000..db2d9aa Binary files /dev/null and b/APL2.1/TP07/Sautoir/Sautoir.class differ diff --git a/APL2.1/TP07/Sautoir/Sautoir.java b/APL2.1/TP07/Sautoir/Sautoir.java new file mode 100644 index 0000000..fae89de --- /dev/null +++ b/APL2.1/TP07/Sautoir/Sautoir.java @@ -0,0 +1,20 @@ +import javax.swing.*; +import java.awt.*; + +public class Sautoir { + public static void main(String[] args) { + JFrame f = new JFrame("Sautoir"); + f.setSize(500, 500); + f.setLocation(100, 100); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setLayout(new GridLayout(6, 5)); + for (int i = 0; i < 30; i++) { + Sablier s = new Sablier(); + s.setLocation(20 + (i%5) * 40, i/5 * 40); + s.setSize(40, 40); + f.add(s); + } + + f.setVisible(true); + } +} \ No newline at end of file