From 4d9cd05088e99ad7a5c20c6ded2ab0c558e8ac78 Mon Sep 17 00:00:00 2001 From: Jacklyn J Videira Date: Sun, 23 Apr 2017 16:23:19 -0400 Subject: [PATCH] Update GameboardWindow.java --- src/view/GameboardWindow.java | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/view/GameboardWindow.java b/src/view/GameboardWindow.java index d6d8c45..efec53c 100644 --- a/src/view/GameboardWindow.java +++ b/src/view/GameboardWindow.java @@ -4,26 +4,38 @@ import controller.*; import java.awt.*; import java.util.ArrayList; -import javax.swing.ImageIcon; -import javax.swing.JPanel; +import javax.swing.*; + import controller.Cashflow; public class GameboardWindow extends JPanel { + + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + GameboardWindow window = new GameboardWindow(board); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + private static final long serialVersionUID = 1L; - private Image img = new ImageIcon(this.getClass().getResource( - "gameboard.png")).getImage(); + private Image img = new ImageIcon(this.getClass().getResource("gameboard.png")).getImage(); - private GameBoard board; + private static GameBoard board; private Point[] points = new Point[24]; private ArrayList Positioners; public GameboardWindow(GameBoard board) { - this.board = board; + GameboardWindow.board = board; Dimension size = new Dimension(img.getWidth(null), img.getHeight(null)); setPreferredSize(size); setMinimumSize(size); @@ -186,7 +198,7 @@ public class GameboardWindow extends JPanel { public void update() { //updates the location of the player on the board for (int i = 0; i < Cashflow.numPlayers; i++) { int x = (int) points[Player[i].getLocation()].getX(); // i will fix this later - int y = (int) points[Player[i].getLocation()].getY(); // hopefully lol + int y = (int) points[Player[i].getLocation()].getY(); // Positioners.get(i).setX(x); Positioners.get(i).setY(y);