a
This commit is contained in:
BIN
APL2.1/TP6_Dessin/tp06/Accueil.class
Normal file
BIN
APL2.1/TP6_Dessin/tp06/Accueil.class
Normal file
Binary file not shown.
25
APL2.1/TP6_Dessin/tp06/Accueil.java
Normal file
25
APL2.1/TP6_Dessin/tp06/Accueil.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Accueil extends JComponent
|
||||
{
|
||||
private Image fond;
|
||||
|
||||
public Accueil()
|
||||
{
|
||||
super();
|
||||
this.fond = Toolkit.getDefaultToolkit().getImage("login.jpg");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau)
|
||||
{
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
if (this.isOpaque())
|
||||
{
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
secondPinceau.drawImage(this.fond, 0, 0, this);
|
||||
}
|
||||
}
|
||||
29
APL2.1/TP6_Dessin/tp06/Cercle.java
Normal file
29
APL2.1/TP6_Dessin/tp06/Cercle.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Cercle extends JComponent
|
||||
{
|
||||
private Color circleColor;
|
||||
|
||||
public Cercle(Color c)
|
||||
{
|
||||
super();
|
||||
this.circleColor = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau)
|
||||
{
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
if (this.isOpaque())
|
||||
{
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
secondPinceau.setColor(circleColor);
|
||||
secondPinceau.fillOval(0, 0, this.getWidth(), this.getHeight());
|
||||
secondPinceau.setColor(Color.WHITE);
|
||||
secondPinceau.fillOval(this.getWidth()/4, this.getHeight()/4, this.getWidth()/2, this.getHeight()/2);
|
||||
}
|
||||
}
|
||||
19
APL2.1/TP6_Dessin/tp06/Ex1.java
Normal file
19
APL2.1/TP6_Dessin/tp06/Ex1.java
Normal file
@@ -0,0 +1,19 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Ex1
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Formes frm = new Formes();
|
||||
|
||||
fenetre.add(frm, BorderLayout.CENTER);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP6_Dessin/tp06/Ex2.class
Normal file
BIN
APL2.1/TP6_Dessin/tp06/Ex2.class
Normal file
Binary file not shown.
31
APL2.1/TP6_Dessin/tp06/Ex2.java
Normal file
31
APL2.1/TP6_Dessin/tp06/Ex2.java
Normal file
@@ -0,0 +1,31 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Ex2
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int rows = 5;
|
||||
int lines = 5;
|
||||
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
fenetre.setSize(rows * 100, lines * 100);
|
||||
fenetre.setMinimumSize(new Dimension(rows * 100, lines * 100));
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(lines, rows);
|
||||
fenetre.setLayout(layout);
|
||||
|
||||
for (int i = 0; i < lines; i++)
|
||||
{
|
||||
for (int j = 0; j < rows; j++)
|
||||
{
|
||||
fenetre.add(new Sablier());
|
||||
}
|
||||
}
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP6_Dessin/tp06/Ex3.class
Normal file
BIN
APL2.1/TP6_Dessin/tp06/Ex3.class
Normal file
Binary file not shown.
33
APL2.1/TP6_Dessin/tp06/Ex3.java
Normal file
33
APL2.1/TP6_Dessin/tp06/Ex3.java
Normal file
@@ -0,0 +1,33 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Ex3
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
fenetre.setSize(285, 210);
|
||||
fenetre.setMinimumSize(new Dimension(285, 210));
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setLayout(null);
|
||||
|
||||
Accueil acc = new Accueil();
|
||||
acc.setLocation(0, 0);
|
||||
acc.setSize(285, 210);
|
||||
fenetre.add(acc);
|
||||
|
||||
JTextField userField = new JTextField();
|
||||
userField.setLocation(110, 90);
|
||||
userField.setSize(150, 25);
|
||||
fenetre.add(userField);
|
||||
|
||||
JTextField passField = new JTextField();
|
||||
passField.setLocation(110, 130);
|
||||
passField.setSize(150, 25);
|
||||
fenetre.add(passField);
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
34
APL2.1/TP6_Dessin/tp06/Ex4.java
Normal file
34
APL2.1/TP6_Dessin/tp06/Ex4.java
Normal file
@@ -0,0 +1,34 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Ex4
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setMinimumSize(new Dimension(500, 500));
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(5, 5);
|
||||
fenetre.setLayout(layout);
|
||||
|
||||
int green = 0;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int blue = 0;
|
||||
green += 51;
|
||||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
blue += 51;
|
||||
fenetre.add(new Cercle(new Color(0, green, blue)));
|
||||
}
|
||||
}
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
35
APL2.1/TP6_Dessin/tp06/Formes.java
Normal file
35
APL2.1/TP6_Dessin/tp06/Formes.java
Normal file
@@ -0,0 +1,35 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Formes extends JComponent
|
||||
{
|
||||
private Image dessin;
|
||||
|
||||
public Formes()
|
||||
{
|
||||
super();
|
||||
this.dessin = Toolkit.getDefaultToolkit().getImage("cercles.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau)
|
||||
{
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
if (this.isOpaque())
|
||||
{
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
secondPinceau.drawImage(this.dessin, 10, 20, this);
|
||||
|
||||
secondPinceau.setColor(Color.CYAN);
|
||||
secondPinceau.drawRect(5,100,50,50);
|
||||
|
||||
secondPinceau.setColor(Color.GREEN);
|
||||
secondPinceau.fillOval(150,5,50,50);
|
||||
|
||||
secondPinceau.setColor(new Color(173, 66, 245));
|
||||
secondPinceau.setFont(new Font("TimesRoman", Font.PLAIN, 24));
|
||||
secondPinceau.drawString(">0<", 150, 100);
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP6_Dessin/tp06/Sablier.class
Normal file
BIN
APL2.1/TP6_Dessin/tp06/Sablier.class
Normal file
Binary file not shown.
34
APL2.1/TP6_Dessin/tp06/Sablier.java
Normal file
34
APL2.1/TP6_Dessin/tp06/Sablier.java
Normal file
@@ -0,0 +1,34 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Sablier extends JComponent
|
||||
{
|
||||
public Sablier()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau)
|
||||
{
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
if (this.isOpaque())
|
||||
{
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
Polygon poly1 = new Polygon();
|
||||
poly1.addPoint(0, 0);
|
||||
poly1.addPoint(this.getWidth(), 0);
|
||||
poly1.addPoint(this.getWidth()/2, this.getHeight()/2);
|
||||
Polygon poly2 = new Polygon();
|
||||
poly2.addPoint(0, this.getHeight());
|
||||
poly2.addPoint(this.getWidth(), this.getHeight());
|
||||
poly2.addPoint(this.getWidth()/2, this.getHeight()/2);
|
||||
|
||||
secondPinceau.setColor(Color.CYAN);
|
||||
secondPinceau.fillPolygon(poly1);
|
||||
secondPinceau.fillPolygon(poly2);
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP6_Dessin/tp06/cercles.png
Normal file
BIN
APL2.1/TP6_Dessin/tp06/cercles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
APL2.1/TP6_Dessin/tp06/login.jpg
Normal file
BIN
APL2.1/TP6_Dessin/tp06/login.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user