a
This commit is contained in:
19
APL2.1/TP6_Dessin/AccPanel.java
Normal file
19
APL2.1/TP6_Dessin/AccPanel.java
Normal file
@@ -0,0 +1,19 @@
|
||||
import java.lang.*;
|
||||
|
||||
public class AccPanel extends JPanel{
|
||||
private Image menuAcc;
|
||||
public AccPanel(){
|
||||
super();
|
||||
this.menuAcc = Toolkit.getDefaultToolkit().getImage("menuAcc.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.menuAcc,0,0, this);
|
||||
}
|
||||
}
|
||||
52
APL2.1/TP6_Dessin/Accueil.java
Normal file
52
APL2.1/TP6_Dessin/Accueil.java
Normal file
@@ -0,0 +1,52 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Accueil extends JComponent{
|
||||
|
||||
private Image logScreen;
|
||||
|
||||
public Accueil(){
|
||||
super();
|
||||
this.logScreen = Toolkit.getDefaultToolkit().getImage("logScreen.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.logScreen,0,0, this);
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
fenetre.setSize(295, 223);
|
||||
fenetre.setMinimumSize(new Dimension(295, 223));
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setLayout(null);
|
||||
|
||||
|
||||
Accueil login = new Accueil();
|
||||
login.setLocation(0,0);
|
||||
login.setSize(278,183);
|
||||
fenetre.add(login);
|
||||
|
||||
JTextField loginArea = new JTextField();
|
||||
loginArea.setLocation(110, 90);
|
||||
loginArea.setSize(150, 25);
|
||||
fenetre.add(loginArea);
|
||||
|
||||
JTextField passwordArea = new JTextField();
|
||||
passwordArea.setLocation(110, 130);
|
||||
passwordArea.setSize(150, 25);
|
||||
fenetre.add(passwordArea);
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
28
APL2.1/TP6_Dessin/Bonjour.java
Normal file
28
APL2.1/TP6_Dessin/Bonjour.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class formes extends JComponent{
|
||||
protected void paintComponent(Graphics pinceau){
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
secondPinceau.setColor(Color.BLUE);
|
||||
secondPinceau.drawRect(0,0,50,50);
|
||||
secondPinceau.setColor(Color.GREEN);
|
||||
secondPinceau.drawOval(50,60,25,25);
|
||||
secondPinceau.fillOval(50,60,25,25);
|
||||
Color couleur1 = new Color(148,0,211);
|
||||
secondPinceau.setColor(couleur1);
|
||||
secondPinceau.setFont(new Font(Font.SERIF,Font.BOLD,24));
|
||||
secondPinceau.drawString(">o<",100,150);
|
||||
Image image = Toolkit.getDefaultToolkit().getImage("cercles.png");
|
||||
secondPinceau.drawImage(image,10,20,this);
|
||||
}
|
||||
public static void main(String[] args){
|
||||
formes a = new formes();
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500,500);
|
||||
fenetre.setLocation(100,100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(a);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
35
APL2.1/TP6_Dessin/Formes.java
Normal file
35
APL2.1/TP6_Dessin/Formes.java
Normal file
@@ -0,0 +1,35 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Formes extends JComponent{
|
||||
|
||||
private Image cercle;
|
||||
|
||||
public Formes(){
|
||||
super();
|
||||
this.cercle = Toolkit.getDefaultToolkit().getImage("cercles.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau){
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
secondPinceau.setColor(Color.GREEN);
|
||||
secondPinceau.drawOval(200,200,50,50);
|
||||
secondPinceau.setColor(Color.BLUE);
|
||||
secondPinceau.drawRect(100,100,50,50);
|
||||
secondPinceau.setColor(Color.PINK);
|
||||
secondPinceau.setFont(new Font(Font.SERIF,Font.BOLD,24));
|
||||
secondPinceau.drawString(">o<",300,300);
|
||||
secondPinceau.drawImage(cercle,100,400,this);
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500,500);
|
||||
fenetre.setLocation(50,50);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
Formes dessin = new Formes();
|
||||
fenetre.add(dessin);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
49
APL2.1/TP6_Dessin/Sautoir.java
Normal file
49
APL2.1/TP6_Dessin/Sautoir.java
Normal file
@@ -0,0 +1,49 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Sautoir extends JComponent{
|
||||
|
||||
public Sautoir(){
|
||||
super();
|
||||
}
|
||||
|
||||
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 sablier = new Polygon();
|
||||
|
||||
secondPinceau.setColor(Color.BLACK);
|
||||
|
||||
//definition des differents points
|
||||
sablier.addPoint(0,0);// en haut a gauche
|
||||
sablier.addPoint(this.getWidth(),0); // en haut a droite
|
||||
sablier.addPoint(this.getWidth()/2,this.getHeight()/2); // au millieu
|
||||
sablier.addPoint(0,this.getHeight());// en bas a gauche
|
||||
sablier.addPoint(this.getWidth(),this.getHeight()); //en bas a droite
|
||||
|
||||
secondPinceau.fillPolygon(sablier); // on remplie le sablier
|
||||
}
|
||||
public static void main(String[] args){
|
||||
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500,500);
|
||||
fenetre.setLocation(100,100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout grille = new GridLayout(5,5);
|
||||
|
||||
fenetre.setLayout(grille);
|
||||
|
||||
for(int i=0; i<25; i++){
|
||||
fenetre.add(new Sautoir());
|
||||
}
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP6_Dessin/cercles.png
Normal file
BIN
APL2.1/TP6_Dessin/cercles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
APL2.1/TP6_Dessin/logScreen.jpg
Normal file
BIN
APL2.1/TP6_Dessin/logScreen.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
29
APL2.1/TP6_Dessin/panelAttente.java
Normal file
29
APL2.1/TP6_Dessin/panelAttente.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*
|
||||
|
||||
public class panelAttente extends JPanel{
|
||||
|
||||
int rayonCercle;
|
||||
int positionCentreX;
|
||||
int positionCentreY;
|
||||
|
||||
public panelAttente(int rayonCercle){
|
||||
super();
|
||||
this.rayonCercle=rayonCercle;
|
||||
this.getCenter();
|
||||
}
|
||||
|
||||
public Position getCenter(){
|
||||
this.positionCentreX = this.getWidth()/2;
|
||||
this.positionCentreY = this.getHeight()/2);
|
||||
}
|
||||
|
||||
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.drawOval(this.positionCentreX, this.positionCentreY,200, 200);
|
||||
}
|
||||
}
|
||||
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