hawxgamer

Untitled

Jan 12th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. package sqe.elevator.gruppeD.gui;
  2.  
  3. import javax.swing.JDialog;
  4. import javax.swing.JFrame;
  5. import javax.swing.JOptionPane;
  6. import javax.swing.WindowConstants;
  7.  
  8. public class ExceptionDialog {
  9.  
  10. public static void displayErrorMsg(String errorMsg) {
  11. JOptionPane pane = new JOptionPane(errorMsg,JOptionPane.ERROR_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
  12. JDialog dialog = pane.createDialog(null, "ECC Error Handling");
  13. dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  14. dialog.setVisible(true);
  15.  
  16. /*
  17. * Alternative, falls dudoch ein Button haben willst und eine Action beim Klick durchführen willst
  18. JOptionPane pane = new JOptionPane(errorMsg,JOptionPane.ERROR_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
  19. int res=pane.showConfirmDialog(pane, errorMsg);
  20. if(res==JOptionPane.OK_OPTION)
  21. {
  22. pane.showConfirmDialog(pane, "lkajsdlkasjd");
  23. }
  24. */
  25.  
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment