123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- package Application1;
- import java.awt.BorderLayout;
- import java.awt.CardLayout;
- import java.awt.Color;
- import java.awt.ComponentOrientation;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.GridBagConstraints;
- import java.awt.GridLayout;
- import java.awt.Image;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.File;
- import java.io.IOException;
-
- import javax.imageio.ImageIO;
- import javax.swing.BorderFactory;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JTextArea;
- import javax.swing.JTextField;
- import javax.swing.border.Border;
- import javax.swing.border.EmptyBorder;
-
- public class Fenetre extends JFrame implements ActionListener{
-
- //Initialisation des objets
- private JPanel conteneur;
- private titre conteneurTitre;
- private JPanel conteneurBouton;
- private JButton boutonrev;
- private JButton boutonsuiv;
- private JButton boutonfininstall;
- private CardLayout cl;
- private FlowLayout fl;
- String[] listContent = {"CARD_1","CARD_2","CARD_3","CARD_4","CARD_5","CARD_6","CARD_7","CARD_8"};
-
- public int Indice = 0;
- public Graphics g ;
-
- public Fenetre() {
- //Création des objets
- conteneur = new JPanel();
- conteneurTitre = new titre();
- conteneurBouton = new JPanel();
-
- Font f = new Font("Serif", Font.BOLD, 15);
-
- boutonrev = new JButton("Précédent");
- boutonrev.setFont(f);
- boutonrev.setForeground(Color.BLACK);
- boutonrev.setBackground(Color.LIGHT_GRAY);
-
- boutonsuiv = new JButton("Suivant");
- boutonsuiv.setFont(f);
- boutonsuiv.setForeground(Color.BLACK);
- boutonsuiv.setBackground(Color.LIGHT_GRAY);
-
- boutonfininstall = new JButton("Lancer VR");
- boutonfininstall.setFont(f);
- boutonfininstall.setForeground(Color.BLACK);
- boutonfininstall.setBackground(Color.LIGHT_GRAY);
-
- cl = new CardLayout();
-
-
- g=getGraphics();
-
- //SetUp de la fenetre
- this.setSize(1200,900);
- this.setLocationRelativeTo(null); //On le garde centrée
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Pour réellement fermer la fenetre
- this.dispose();
- this.setUndecorated(false);
- conteneur.setPreferredSize(new Dimension(1100,640));
- conteneurBouton.setPreferredSize(new Dimension(1200,50));
-
-
- //Création des pages
- ImagePanel card1 = new ImagePanel("test.png");
- carte card2 = new carte(2,1);
- carte card3 = new carte(3,1);
- carte card4 = new carte(4,1);
- carte card5 = new carte (5,1);
- carte card6 = new carte (6,1);
- carte card7 = new carte (7,1);
- carte card8 = new carte(8,1);
-
- cl.setHgap(10);
- cl.setVgap(10);
-
-
- //SetUp des conteneurs
-
- conteneurBouton.setBackground(Color.WHITE);
- conteneurBouton.add(boutonrev);
- conteneurBouton.add(boutonsuiv);
- conteneurBouton.add(boutonfininstall);
-
- conteneur.setBackground(Color.white);
- conteneurTitre.setBackground(Color.white);
- conteneur.setLayout(cl);
- conteneur.add(card1,listContent[0]);
- conteneur.add(card2,listContent[1]);
- conteneur.add(card3,listContent[2]);
- conteneur.add(card4,listContent[3]);
- conteneur.add(card5,listContent[4]);
- conteneur.add(card6,listContent[5]);
- conteneur.add(card7,listContent[6]);
-
- conteneur.add(card8,listContent[7]);
-
-
-
-
-
- // Gestion de l'action des Boutons
-
- boutonsuiv.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- cl.next(conteneur);
-
- }
- });
-
- boutonrev.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- cl.previous(conteneur);
-
- }
- });
-
- boutonfininstall.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- cl.show(conteneur,"CARD_8");
-
- }
- });
-
-
- //Affichage
- this.getContentPane().add(conteneurBouton, BorderLayout.SOUTH);
- this.getContentPane().add(conteneur, BorderLayout.CENTER);
- this.getContentPane().add(conteneurTitre,BorderLayout.NORTH);
- this.setVisible(true);
- conteneurTitre.setBorder(new EmptyBorder(10,10,10,10));
-
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- }
|