Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. cancelButton.setToolTipText("Return to the main menu.");
  2. cancelButton.setMnemonic(KeyEvent.VK_C);
  3. btn.addActionListener(new ActionListener() {
  4. @Override
  5. public void actionPerformed(ActionEvent e) {
  6. String[] options = {"Yes", "No"};
  7. int choice = JOptionPane.showOptionDialog(null, "Are you sure you "
  8. + "want to cancel the operation?\nAll the information will be lost.",
  9. "Return to the main menu", JOptionPane.YES_NO_OPTION,
  10. JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
  11. if (choice == YES_OPTION) {
  12. dispose();
  13. //MainMenuUI mainMenu;
  14. // try {
  15. // UIManager.setLookAndFeel(
  16. // "javax.swing.plaf.metal.MetalLookAndFeel");
  17. // mainMenu = new MainMenuUI("Main menu:", pl);
  18. // } catch (ClassNotFoundException | IllegalAccessException
  19. // | InstantiationException | UnsupportedLookAndFeelException ex) {
  20. // JOptionPane.showMessageDialog(null, ex.getMessage(),
  21. // "Error", JOptionPane.ERROR_MESSAGE);
  22. // }
  23. }
  24. }
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement