mirror of
https://github.com/LucasVbr/LecteurPdfDoubleAffichage.git
synced 2026-07-09 12:47:45 +00:00
codage de l'ouverture du menu et du pdf
This commit is contained in:
@@ -13,7 +13,6 @@ import javax.swing.*;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* classe de gestion des fenêtres
|
* classe de gestion des fenêtres
|
||||||
@@ -28,27 +27,33 @@ public class gestionFenetre {
|
|||||||
|
|
||||||
|
|
||||||
final int NB_MAX_FENETRE = 2 ;
|
final int NB_MAX_FENETRE = 2 ;
|
||||||
private ArrayList<Fenetre> fenetresOuvertes;
|
private Fenetre[] fenetresOuvertes;
|
||||||
|
File fichier = null ;
|
||||||
|
|
||||||
|
|
||||||
public void ouvrirPDF() throws IOException {
|
public void ouvrirFenetre(){
|
||||||
PDF doc = new PDF(new File("F:/test_pdf1.pdf"));
|
int placeVide;
|
||||||
|
for (placeVide=0; placeVide<2; placeVide++){
|
||||||
JScrollPane scrollPane = new JScrollPane(doc);
|
if (fenetresOuvertes[placeVide]==null){
|
||||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
break;
|
||||||
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
}
|
||||||
//this.getContentPane().add(scrollPane);
|
}
|
||||||
try {
|
if(placeVide==2) {
|
||||||
JPanel pdf = new PDF(Menu.fichier);
|
//todo erreur trop de fenetres
|
||||||
} catch (IOException e) {
|
}else {
|
||||||
e.printStackTrace();
|
Fenetre fenetre = new Fenetre();
|
||||||
|
fenetresOuvertes[placeVide] = fenetre;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void fermerPDF(){
|
public void fermerFenetre(JFrame fenetre){
|
||||||
|
for (int i = 0; i<2 ; i++){
|
||||||
|
if (fenetre==fenetresOuvertes[i]){
|
||||||
|
fenetre.dispose();
|
||||||
|
fenetresOuvertes[i]= null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static void main (String[] args) {
|
public static void main(String[] args) {
|
||||||
JFrame fenetrePrincipale = new Fenetre();
|
JFrame fenetrePrincipale = new Fenetre();
|
||||||
//fenetrePrincipale.ouvrirPDF();
|
//fenetrePrincipale.ouvrirPDF();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user