This commit is contained in:
unknown
2022-01-14 06:54:18 +01:00
commit d9949b5cb0
288 changed files with 6425 additions and 0 deletions

Binary file not shown.

View 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);
}
}

View 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);
}
}

View 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);
}
}

Binary file not shown.

View 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);
}
}

Binary file not shown.

View 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);
}
}

View 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);
}
}

View 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);
}
}

Binary file not shown.

View 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);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB