Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package com.chat;
  2.  
  3. import java.awt.event.ActionListener;
  4.  
  5. /**
  6.  * Controls a {@link View}.
  7.  *
  8.  * @author Ludwig
  9.  *
  10.  */
  11. public class Controller {
  12.  
  13.     private View view;
  14.    
  15.     /**
  16.      * Creates a new controller.
  17.      */
  18.     public Controller() {
  19.         view = new View();
  20.        
  21.         ActionListener al = event -> {
  22.             view.sendMessage(view.getMessage() + '\n');
  23.         };
  24.        
  25.         view.addActionListener(al);
  26.     }
  27.    
  28.     /**
  29.      * The entry point of the application.
  30.      *
  31.      * @param args
  32.      *      The command-line arguments.
  33.      */
  34.     public static void main(String[] args) {
  35.         new Controller();
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement