Advertisement
0xff42

KWBAController

Aug 5th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. import java.awt.event.ActionEvent;
  2. import java.awt.event.ActionListener;
  3. import java.io.IOException;
  4.  
  5. import javax.swing.KeyStroke;
  6.  
  7. public class KWBAController {
  8.     private KWBAModel model;
  9.     private KWBAGUI gui;
  10.    
  11.     public KWBAController(KWBAModel m1, KWBAGUI g1) throws IOException{
  12.     this.model = m1;
  13.     m1.getPicture();
  14.     this.gui = g1;
  15.     g1.getMntmRefresh().setAccelerator(
  16.         KeyStroke.getKeyStroke("F5")
  17.         );
  18.     g1.getMntmRefresh().addActionListener(
  19.         new ActionListener() {
  20.  
  21.             @Override
  22.             public void actionPerformed(ActionEvent e) {
  23.             try {
  24.                 model.getPicture();
  25.                 gui.refreshPicture();
  26.             } catch (IOException e1) {
  27.                 e1.printStackTrace();
  28.             }
  29.            
  30.             }
  31.         }
  32.         );
  33.     g1.getMntmAbout().setAccelerator(
  34.         KeyStroke.getKeyStroke("F1")
  35.         );
  36.     g1.getMntmAbout().addActionListener(
  37.         new ActionListener() {
  38.            
  39.             @Override
  40.             public void actionPerformed(ActionEvent arg0) {
  41.             gui.showHelp();
  42.             }
  43.         }
  44.         );
  45.     g1.getMntmExit().addActionListener(
  46.         new ActionListener(){
  47.  
  48.             @Override
  49.             public void actionPerformed(ActionEvent e) {
  50.             System.exit(0);
  51.             }
  52.            
  53.         }
  54.         );
  55.     }
  56.    
  57.     @SuppressWarnings("unused")
  58.     public static void main(String args[]){
  59.     try {
  60.         KWBAController c = new KWBAController(new KWBAModel(), new KWBAGUI());
  61.     } catch (IOException e) {
  62.         // TODO Auto-generated catch block
  63.         e.printStackTrace();
  64.     }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement