Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update GameboardWindow.java
  • Loading branch information
jjv14001 committed Apr 23, 2017
1 parent 454e127 commit 4d9cd05
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/view/GameboardWindow.java
Expand Up @@ -4,26 +4,38 @@ import controller.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;


import javax.swing.ImageIcon; import javax.swing.*;
import javax.swing.JPanel;


import controller.Cashflow; import controller.Cashflow;


public class GameboardWindow extends JPanel { 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 static final long serialVersionUID = 1L;
private Image img = new ImageIcon(this.getClass().getResource( private Image img = new ImageIcon(this.getClass().getResource("gameboard.png")).getImage();
"gameboard.png")).getImage();


private GameBoard board; private static GameBoard board;
private Point[] points = new Point[24]; private Point[] points = new Point[24];


private ArrayList<Positioner> Positioners; private ArrayList<Positioner> Positioners;




public GameboardWindow(GameBoard board) { public GameboardWindow(GameBoard board) {
this.board = board; GameboardWindow.board = board;
Dimension size = new Dimension(img.getWidth(null), img.getHeight(null)); Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
setPreferredSize(size); setPreferredSize(size);
setMinimumSize(size); setMinimumSize(size);
Expand Down Expand Up @@ -186,7 +198,7 @@ public class GameboardWindow extends JPanel {
public void update() { //updates the location of the player on the board public void update() { //updates the location of the player on the board
for (int i = 0; i < Cashflow.numPlayers; i++) { for (int i = 0; i < Cashflow.numPlayers; i++) {
int x = (int) points[Player[i].getLocation()].getX(); // i will fix this later 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).setX(x);
Positioners.get(i).setY(y); Positioners.get(i).setY(y);


Expand Down

0 comments on commit 4d9cd05

Please sign in to comment.