package fenetres.create_act; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.KeyStroke; import fenetres.create; public class actExit extends AbstractAction { { putValue( Action.NAME, "Quitter" ); putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/exitmini.png")) ); putValue( Action.LARGE_ICON_KEY, new ImageIcon(create.class.getResource("/resources/exit.png")) ); putValue( Action.MNEMONIC_KEY, KeyEvent.VK_Q ); putValue( Action.SHORT_DESCRIPTION, "Quitter (CRTL+Q)" ); putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK ) ); } /** * */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter ?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) { create.getInstance().dispose(); } } }