update
This commit is contained in:
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Accueil.class
Normal file
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Accueil.class
Normal file
Binary file not shown.
40
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Accueil.java
Normal file
40
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Accueil.java
Normal file
@@ -0,0 +1,40 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Accueil extends JComponent {
|
||||
private Image acc;
|
||||
public Accueil() {
|
||||
super();
|
||||
this.acc = 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.acc,0,0,this);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
Accueil imag = new Accueil();
|
||||
JTextField champlog = new JTextField();
|
||||
JTextField champmdp = new JTextField();
|
||||
fenetre.setLayout(null);
|
||||
fenetre.setSize(290,220);
|
||||
fenetre.setLocation(0,0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
imag.setLocation(0,0);
|
||||
imag.setSize(278,183);
|
||||
champlog.setSize(160,20);
|
||||
champlog.setLocation(102,92);
|
||||
champmdp.setSize(160,20);
|
||||
champmdp.setLocation(102,134);
|
||||
fenetre.add(imag);
|
||||
fenetre.add(champlog);
|
||||
fenetre.add(champmdp);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/AfficheImage.class
Normal file
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/AfficheImage.class
Normal file
Binary file not shown.
21
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/AfficheImage.java
Normal file
21
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/AfficheImage.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class AfficheImage extends JComponent {
|
||||
private Image fond;
|
||||
|
||||
public AfficheImage(String cheminImage) {
|
||||
super();
|
||||
this.fond = Toolkit.getDefaultToolkit().getImage(cheminImage);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
27
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/AfficheImage.java~
Normal file
27
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/AfficheImage.java~
Normal file
@@ -0,0 +1,27 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class AfficheImage extends JComponent {
|
||||
private Image fond;
|
||||
|
||||
public AfficheImage(String cheminImage) {
|
||||
super();
|
||||
this.fond = Toolkit.getDefaultToolkit().getImage(cheminImage);
|
||||
}
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return new Dimension(288, 215);
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
int x = (this.getWidth() - fond.getWidth(this)) / 2;
|
||||
int y = (this.getHeight() - fond.getHeight(this)) / 2;
|
||||
secondPinceau.drawImage(this.fond, x, y, this);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Q3Main.class
Normal file
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Q3Main.class
Normal file
Binary file not shown.
28
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Q3Main.java
Normal file
28
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Q3Main.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Q3Main{
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame("Acceuil");
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setSize(288,223);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setLayout(null);
|
||||
|
||||
AfficheImage fond = new AfficheImage("login.jpg");
|
||||
fond.setSize(278,183);
|
||||
fond.setLocation(0,5);
|
||||
|
||||
JTextField identifiant = new JTextField();
|
||||
identifiant.setSize(150,29);
|
||||
identifiant.setLocation(110,95);
|
||||
|
||||
JTextField motDePasse = new JTextField();
|
||||
motDePasse.setSize(150,29);
|
||||
motDePasse.setLocation(110,135);
|
||||
|
||||
fenetre.add(fond);
|
||||
fenetre.add(identifiant);
|
||||
fenetre.add(motDePasse);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
33
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Q3Main.java~
Normal file
33
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/Q3Main.java~
Normal file
@@ -0,0 +1,33 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Q3Main{
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame("Acceuil");
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setSize(288,215);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
AfficheImage fond = new AfficheImage("login.jpg");
|
||||
fond.setBounds(0, 0, 288, 215);
|
||||
|
||||
JTextField identifiant = new JTextField();
|
||||
identifiant.setBounds(110, 105, 150, 30);
|
||||
|
||||
JTextField motDePasse = new JTextField();
|
||||
motDePasse.setBounds(110, 145, 150, 30);
|
||||
|
||||
JPanel entrees = new JPanel();
|
||||
entrees.setLayout(null);
|
||||
entrees.setOpaque(false);
|
||||
entrees.setBounds(0, 0, 288, 215);
|
||||
entrees.add(identifiant);
|
||||
entrees.add(motDePasse);
|
||||
|
||||
JPanel contenus = new JPanel(null);
|
||||
contenus.add(fond);
|
||||
contenus.add(entrees);
|
||||
|
||||
fenetre.setContentPane(contenus);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/login.jpg
Normal file
BIN
DEV/DEV2.1/TP06_Dessin/Q3_Acceuil/login.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user