Advertisement
Guest User

Untitled

a guest
Oct 11th, 2013
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.61 KB | None | 0 0
  1. package tetris;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.awt.event.WindowEvent;
  6. import java.awt.event.WindowListener;
  7.  
  8. import javax.swing.JOptionPane;
  9.  
  10. public class Listener_Adapter implements WindowListener, ActionListener{
  11.  
  12.     public Listener_Adapter(){};
  13.        
  14.         public void windowClosing(WindowEvent arg0) {
  15.             System.exit(0);
  16.         }
  17.         public void windowActivated(WindowEvent arg0) {
  18.             // TODO Auto-generated method stub
  19.            
  20.         }
  21.         public void windowClosed(WindowEvent arg0) {
  22.             // TODO Auto-generated method stub
  23.            
  24.         }
  25.         public void windowDeactivated(WindowEvent arg0) {
  26.             // TODO Auto-generated method stub
  27.            
  28.         }
  29.         public void windowDeiconified(WindowEvent arg0) {
  30.             // TODO Auto-generated method stub
  31.            
  32.         }
  33.         public void windowIconified(WindowEvent arg0) {
  34.             // TODO Auto-generated method stub
  35.            
  36.         }
  37.         public void windowOpened(WindowEvent arg0) {
  38.             // TODO Auto-generated method stub
  39.            
  40.         }
  41.         public void actionPerformed(ActionEvent e){
  42.            
  43.             if(e.getActionCommand().equals("1")){
  44.                 new Tetris_Frame();
  45.             }
  46.             if(e.getActionCommand().equals("2")){
  47.                 ;
  48.             }
  49.             if(e.getActionCommand().equals("3")){
  50.                 new Options_Frame();
  51.             }
  52.             if(e.getActionCommand().equals("4")){
  53.                 int confirm = JOptionPane.showOptionDialog(null, "Really wanna close the game?", "Exit Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
  54.                 if (confirm == 0) {
  55.                    System.exit(0);
  56.                 }
  57.             }
  58.             if(e.getActionCommand().equals("Back to menu")){
  59.                 new Main_Frame();
  60.             }
  61.         }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement