mirror of
https://github.com/LucasVbr/LecteurPdfDoubleAffichage.git
synced 2026-12-05 18:30:49 +00:00
Edit interface Raccourcis claviers + refactor de code
This commit is contained in:
@@ -11,6 +11,7 @@ import lecteur_pdf.IhmPdf;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
@@ -31,29 +32,28 @@ public class FermerFichier extends MenuItem {
|
||||
public FermerFichier(IhmPdf parent) {
|
||||
super(parent, "Fermer");
|
||||
|
||||
/* Action du bouton */
|
||||
addActionListener(e -> {
|
||||
JDialog jd = new JDialog();
|
||||
jd.setLayout(new FlowLayout());
|
||||
jd.setBounds(500,300,400,100);
|
||||
JLabel jlabel = new JLabel("etes vous sûr de vouloir fermer ? ");
|
||||
JButton oui = new JButton("oui");
|
||||
oui.addActionListener(m -> {
|
||||
parent.getPdfPanel().dechargerPdf();
|
||||
parent.setTitle(GestionPdf.TITRE_APPLICATION);
|
||||
parent.pack();
|
||||
jd.setVisible(false);
|
||||
});
|
||||
JButton non = new JButton("non");
|
||||
non.addActionListener(n -> jd.setVisible(false));
|
||||
jd.add(jlabel);
|
||||
jd.add(oui);
|
||||
jd.add(non);
|
||||
jd.setVisible(true);
|
||||
|
||||
});
|
||||
|
||||
/* TODO Définition du raccourcis clavier a modifier */
|
||||
setRaccourcis(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK);
|
||||
// setRaccourcis(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void action(ActionEvent evt) {
|
||||
JDialog jd = new JDialog();
|
||||
jd.setLayout(new FlowLayout());
|
||||
jd.setBounds(500,300,400,100);
|
||||
JLabel jlabel = new JLabel("etes vous sûr de vouloir fermer ? ");
|
||||
JButton oui = new JButton("oui");
|
||||
oui.addActionListener(m -> {
|
||||
parent.getPdfPanel().dechargerPdf();
|
||||
parent.setTitle(GestionPdf.TITRE_APPLICATION);
|
||||
parent.pack();
|
||||
jd.setVisible(false);
|
||||
});
|
||||
JButton non = new JButton("non");
|
||||
non.addActionListener(n -> jd.setVisible(false));
|
||||
jd.add(jlabel);
|
||||
jd.add(oui);
|
||||
jd.add(non);
|
||||
jd.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user