No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Fenetre.java 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. package Application1;
  2. import java.awt.BorderLayout;
  3. import java.awt.CardLayout;
  4. import java.awt.Color;
  5. import java.awt.ComponentOrientation;
  6. import java.awt.Dimension;
  7. import java.awt.FlowLayout;
  8. import java.awt.Font;
  9. import java.awt.Graphics;
  10. import java.awt.GridBagConstraints;
  11. import java.awt.GridLayout;
  12. import java.awt.Image;
  13. import java.awt.event.ActionEvent;
  14. import java.awt.event.ActionListener;
  15. import java.io.File;
  16. import java.io.IOException;
  17. import javax.imageio.ImageIO;
  18. import javax.swing.BorderFactory;
  19. import javax.swing.JButton;
  20. import javax.swing.JFrame;
  21. import javax.swing.JLabel;
  22. import javax.swing.JPanel;
  23. import javax.swing.JTextArea;
  24. import javax.swing.JTextField;
  25. import javax.swing.border.Border;
  26. import javax.swing.border.EmptyBorder;
  27. import javax.swing.border.EtchedBorder;
  28. import Application1.Pages.*;
  29. public class Fenetre extends JFrame implements ActionListener{
  30. //Initialisation des objets
  31. private JPanel conteneur;
  32. private titre conteneurTitre;
  33. private JPanel conteneurBouton;
  34. private JButton boutonrev;
  35. private JButton boutonsuiv;
  36. private JButton boutonfininstall;
  37. private CardLayout cl;
  38. private FlowLayout fl;
  39. String[] listContent = {"CARD_1","CARD_2","CARD_3","CARD_4","CARD_5","CARD_6","CARD_7","CARD_8"};
  40. public int Indice = 0;
  41. public Graphics g ;
  42. public Fenetre() {
  43. //Création des objets
  44. conteneur = new JPanel();
  45. conteneurTitre = new titre();
  46. conteneurBouton = new JPanel();
  47. Font f = new Font("Serif", Font.BOLD, 15);
  48. boutonrev = new JButton("Précédent");
  49. boutonrev.setFont(f);
  50. boutonrev.setForeground(Color.BLACK);
  51. boutonrev.setBackground(Color.LIGHT_GRAY);
  52. boutonsuiv = new JButton("Suivant");
  53. boutonsuiv.setFont(f);
  54. boutonsuiv.setForeground(Color.BLACK);
  55. boutonsuiv.setBackground(Color.LIGHT_GRAY);
  56. boutonfininstall = new JButton("Lancer VR");
  57. boutonfininstall.setFont(f);
  58. boutonfininstall.setForeground(Color.BLACK);
  59. boutonfininstall.setBackground(Color.LIGHT_GRAY);
  60. cl = new CardLayout();
  61. Border border = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
  62. Border blackline = BorderFactory.createLineBorder(Color.black);
  63. Border compound;
  64. compound = BorderFactory.createCompoundBorder(border, blackline);
  65. g=getGraphics();
  66. //SetUp de la fenetre
  67. this.setSize(1200,900);
  68. this.setLocationRelativeTo(null); //On le garde centrée
  69. this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Pour réellement fermer la fenetre
  70. this.dispose();
  71. this.setUndecorated(false);
  72. conteneur.setPreferredSize(new Dimension(1100,640));
  73. conteneurBouton.setPreferredSize(new Dimension(1200,50));
  74. //Création des pages
  75. ImagePanel card1 = new ImagePanel("test.png");
  76. Page1 card2 = new Page1(15,compound);
  77. Page2 card3 = new Page2(15,compound);
  78. Page3 card4 = new Page3(15,compound);
  79. Page4 card5 = new Page4 (15,compound);
  80. Page5 card6 = new Page5(15,compound);
  81. Page6 card7 = new Page6(15,compound);
  82. Page7 card8 = new Page7(15,compound);
  83. cl.setHgap(10);
  84. cl.setVgap(10);
  85. //SetUp des conteneurs
  86. conteneurBouton.setBackground(Color.WHITE);
  87. conteneurBouton.add(boutonrev);
  88. conteneurBouton.add(boutonsuiv);
  89. conteneurBouton.add(boutonfininstall);
  90. conteneur.setBackground(Color.white);
  91. conteneurTitre.setBackground(Color.white);
  92. conteneur.setLayout(cl);
  93. conteneur.add(card1,listContent[0]);
  94. conteneur.add(card2,listContent[1]);
  95. conteneur.add(card3,listContent[2]);
  96. conteneur.add(card4,listContent[3]);
  97. conteneur.add(card5,listContent[4]);
  98. conteneur.add(card6,listContent[5]);
  99. conteneur.add(card7,listContent[6]);
  100. conteneur.add(card8,listContent[7]);
  101. // Gestion de l'action des Boutons
  102. boutonsuiv.addActionListener(new ActionListener() {
  103. public void actionPerformed(ActionEvent event) {
  104. cl.next(conteneur);
  105. }
  106. });
  107. boutonrev.addActionListener(new ActionListener() {
  108. public void actionPerformed(ActionEvent event) {
  109. cl.previous(conteneur);
  110. }
  111. });
  112. boutonfininstall.addActionListener(new ActionListener() {
  113. public void actionPerformed(ActionEvent event) {
  114. cl.show(conteneur,"CARD_8");
  115. }
  116. });
  117. //Affichage
  118. this.getContentPane().add(conteneurBouton, BorderLayout.SOUTH);
  119. this.getContentPane().add(conteneur, BorderLayout.CENTER);
  120. this.getContentPane().add(conteneurTitre,BorderLayout.NORTH);
  121. this.setVisible(true);
  122. conteneurTitre.setBorder(new EmptyBorder(10,10,10,10));
  123. }
  124. public void actionPerformed(ActionEvent arg0) {
  125. // TODO Auto-generated method stub
  126. }
  127. }