SA MARCHE

This commit is contained in:
LucasV-IUT
2021-11-28 20:46:50 +01:00
parent 555c1006cd
commit 0ce4f8ed85
5 changed files with 187 additions and 164 deletions
+56 -15
View File
@@ -8,44 +8,85 @@ package lecteur_pdf.affichage;
import lecteur_pdf.document.PDF;
import lecteur_pdf.menu.Menu;
import javax.swing.*;
import java.io.File;
/**
* classe correspondant à l'objet Fenetre
* classe correspondant à lobjet Fenêtre
*
* @author Léo FRANCH
* @author Tristan NOGARET
* @author Lucàs VABRE
* @author Noé VILLENEUVE
* @version 1.0
* @version 1.0
*/
public class Fenetre extends JFrame {
//private JFrame frame;
private String titre ;
private Menu menu = new Menu(this);
private PDF pdf ;
/**
* TODO
*/
private String titre;
/**
* TODO
*/
private Menu menu;
public Fenetre(){
//création du frame
/**
* TODO
*/
private PDF fichierPDF;
/**
* TODO
*/
public Fenetre() {
// Création du menu
Menu menu = new Menu(this);
menu = new Menu(this);
// Ajout de la barre de menu au frame
this.setJMenuBar(menu.getMenuBar());
this.setSize( 300 ,300);
this.setLayout(null);
this.setJMenuBar(menu);
this.setSize(300, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setVisible(true);
}
/**
* TODO
*
* @param fichier
*/
public void chargerPdf(File fichier) {
fichierPDF = new PDF(fichier);
/* Crée l’élément scrollable */
JScrollPane scrollPane = new JScrollPane(fichierPDF);
scrollPane.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setUnitIncrement(16);
/* Supprime le précédent PDF */
this.getContentPane().removeAll();
/* Affiche le nouveau PDF */
this.getContentPane().add(scrollPane);
this.validate();
}
/**
* TODO comment main
*
* @param args non utilisé
*/
public static void main(String[] args) {
new Fenetre();
}
}