Advertisement
Avatarr

rubikMVC_view

Dec 5th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.16 KB | None | 0 0
  1. public class RubikView extends javax.swing.JFrame {
  2.  
  3.     Rubik model;
  4.     RubikController controller;
  5.  
  6.     /** Creates new form RubicView */
  7.     public RubikView() {
  8.         model = new Rubik();
  9.         controller = new RubikController();
  10.         controller.setModel(model);
  11.         controller.setView(this);
  12.  
  13.         initComponents();
  14.  
  15.         updateView();
  16.     }
  17.  
  18.     public void updateView() {
  19.         // กำลังจะขึ้นส่วนการ update หลังจากที่เกิน event
  20.         this.pnlColor1.setBackground(controller.getColor(0, 0, 1));
  21.         this.pnlColor2.setBackground(controller.getColor(0, 1, 1));
  22.         this.pnlColor3.setBackground(controller.getColor(0, 2, 1));
  23.        
  24.         this.pnlColor4.setBackground(controller.getColor(1, 0, 1));
  25.         this.pnlColor5.setBackground(controller.getColor(1, 1, 1));
  26.         this.pnlColor6.setBackground(controller.getColor(1, 2, 1));
  27.        
  28.         this.pnlColor7.setBackground(controller.getColor(2, 0, 1));
  29.         this.pnlColor8.setBackground(controller.getColor(2, 1, 1));
  30.         this.pnlColor9.setBackground(controller.getColor(2, 2, 1));
  31.     }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement