TP07
This commit is contained in:
parent
a5665f3b23
commit
ae43ed1b4f
BIN
APL2.1/TP07/Accueil/Accueil.class
Normal file
BIN
APL2.1/TP07/Accueil/Accueil.class
Normal file
Binary file not shown.
32
APL2.1/TP07/Accueil/Accueil.java
Normal file
32
APL2.1/TP07/Accueil/Accueil.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP07/Accueil/LoginScreen.class
Normal file
BIN
APL2.1/TP07/Accueil/LoginScreen.class
Normal file
Binary file not shown.
22
APL2.1/TP07/Accueil/LoginScreen.java
Normal file
22
APL2.1/TP07/Accueil/LoginScreen.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP07/Accueil/login.jpg
Normal file
BIN
APL2.1/TP07/Accueil/login.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
BIN
APL2.1/TP07/Cercles/Cercles.class
Normal file
BIN
APL2.1/TP07/Cercles/Cercles.class
Normal file
Binary file not shown.
20
APL2.1/TP07/Cercles/Cercles.java
Normal file
20
APL2.1/TP07/Cercles/Cercles.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP07/Cercles/Circles.class
Normal file
BIN
APL2.1/TP07/Cercles/Circles.class
Normal file
Binary file not shown.
31
APL2.1/TP07/Cercles/Circles.java
Normal file
31
APL2.1/TP07/Cercles/Circles.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
@ -1,25 +1,6 @@
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
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 class Formes {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JFrame f = new JFrame("Formes");
|
JFrame f = new JFrame("Formes");
|
||||||
@ -27,6 +8,8 @@ public class Formes {
|
|||||||
f.setLocation(100, 100);
|
f.setLocation(100, 100);
|
||||||
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
f.add(new NewPanel());
|
||||||
|
|
||||||
f.setVisible(true);
|
f.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
BIN
APL2.1/TP07/Formes/NewPanel.class
Normal file
BIN
APL2.1/TP07/Formes/NewPanel.class
Normal file
Binary file not shown.
29
APL2.1/TP07/Formes/NewPanel.java
Normal file
29
APL2.1/TP07/Formes/NewPanel.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP07/Sautoir/Sablier.class
Normal file
BIN
APL2.1/TP07/Sautoir/Sablier.class
Normal file
Binary file not shown.
29
APL2.1/TP07/Sautoir/Sablier.java
Normal file
29
APL2.1/TP07/Sautoir/Sablier.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP07/Sautoir/Sautoir.class
Normal file
BIN
APL2.1/TP07/Sautoir/Sautoir.class
Normal file
Binary file not shown.
20
APL2.1/TP07/Sautoir/Sautoir.java
Normal file
20
APL2.1/TP07/Sautoir/Sautoir.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user