Advertisement
puttepw

MVCModel

May 19th, 2011
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.67 KB | None | 0 0
  1. import java.util.Observable;
  2.  
  3.  
  4. public class GameModel extends Observable
  5. {
  6.     private boolean btn1 = true;
  7.     private boolean btn2 = true;
  8.     private boolean btn3 = true;
  9.     private boolean btn4 = true;
  10.     private boolean btn5 = true;
  11.     private boolean btn6 = true;
  12.     private boolean btn7 = true;
  13.     private boolean btn8 = true;
  14.     private boolean btn9 = true;
  15.    
  16.     public void btn1ChangeFalse()
  17.     {
  18.             btn1=false;
  19.             setChanged();
  20.             notifyObservers();
  21.        
  22.     }
  23.    
  24.    
  25.    
  26.     public void btn2ChangeFalse()
  27.     {
  28.             btn2=false;
  29.        
  30.         setChanged();
  31.         notifyObservers();
  32.     }
  33.    
  34.    
  35.    
  36.     public void btn3ChangeFalse()
  37.     {
  38.             btn3=false;
  39.                
  40.        
  41.         setChanged();
  42.         notifyObservers();
  43.    
  44.     }
  45.    
  46.    
  47.     public void btn4ChangeFalse()
  48.     {
  49.        
  50.             btn4=false;
  51.        
  52.        
  53.         setChanged();
  54.         notifyObservers();
  55.     }
  56.    
  57.    
  58.     public void btn5ChangeFalse()
  59.     {  
  60.        
  61.         btn5=false;
  62.    
  63.    
  64.     setChanged();
  65.     notifyObservers();
  66.     }
  67.    
  68.    
  69.     public void btn6ChangeFalse()
  70.     {
  71.        
  72.             btn6=false;
  73.        
  74.        
  75.         setChanged();
  76.         notifyObservers();
  77.     }
  78.    
  79.    
  80.     public void btn7ChangeFalse()
  81.     {
  82.        
  83.             btn7=false;
  84.        
  85.        
  86.         setChanged();
  87.         notifyObservers();
  88.     }
  89.    
  90.    
  91.     public void btn8ChangeFalse()
  92.     {
  93.        
  94.             btn8=false;
  95.        
  96.         setChanged();
  97.         notifyObservers();
  98.     }
  99.    
  100.     public void btn9ChangeFalse()
  101.     {
  102.        
  103.             btn9=false;
  104.        
  105.         setChanged();
  106.         notifyObservers();
  107.     }
  108.    
  109.    
  110.     public void btn1ChangeTrue()
  111.     {
  112.         btn1=true;
  113.     }
  114.    
  115.     public void btn2ChangeTrue()
  116.     {
  117.         btn2=true;
  118.     }
  119.    
  120.    
  121.     public void btn3ChangeTrue()
  122.     {
  123.         btn3=true;
  124.     }
  125.    
  126.     public void btn4ChangeTrue()
  127.     {
  128.         btn4=true;
  129.     }
  130.    
  131.     public void btn5ChangeTrue()
  132.     {
  133.         btn5=true;
  134.     }
  135.    
  136.     public void btn6ChangeTrue()
  137.     {
  138.         btn6=true;
  139.     }
  140.    
  141.     public void btn7ChangeTrue()
  142.     {
  143.         btn7=true;
  144.     }
  145.    
  146.     public void btn8ChangeTrue()
  147.     {
  148.         btn8=true;
  149.     }
  150.    
  151.     public void btn9ChangeTrue()
  152.     {
  153.         btn9=true;
  154.     }
  155.    
  156.    
  157.    
  158.    
  159.     public boolean btn1State()
  160.     {
  161.         return btn1;
  162.        
  163.     }
  164.    
  165.     public boolean btn2State()
  166.     {
  167.         return btn2;
  168.        
  169.     }
  170.    
  171.     public boolean btn3State()
  172.     {
  173.         return btn3;
  174.        
  175.     }
  176.    
  177.     public boolean btn4State()
  178.     {
  179.         return btn4;
  180.        
  181.     }
  182.    
  183.     public boolean btn5State()
  184.     {
  185.         return btn5;
  186.        
  187.     }
  188.    
  189.     public boolean btn6State()
  190.     {
  191.         return btn6;
  192.        
  193.     }
  194.    
  195.     public boolean btn7State()
  196.     {
  197.         return btn7;
  198.        
  199.     }
  200.    
  201.     public boolean btn8State()
  202.     {
  203.         return btn8;
  204.        
  205.     }
  206.    
  207.     public boolean btn9State()
  208.     {
  209.         return btn9;
  210.        
  211.     }
  212.    
  213.  
  214.    
  215.     public static void main(String[]args)
  216.     {
  217.         GameModel model = new GameModel();
  218.         GameController controller = new GameController(model);
  219.         GameView view = new GameView(controller, model);
  220.         GameView view2 = new GameView(controller, model);
  221.  
  222.         model.addObserver(view2);
  223.         model.addObserver(view);
  224.        
  225.     }
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement