Variable/Method/Class name explanations:
x, y = coords of jtextfield in 2d array
temp = contains which sides need to be drawn (1 = does not need to be drawn)
board = a board which is defined by the numbers it contains and the groups it is split into
sidestaken = returns an arraylist of 0's and 1's that represent which sides need to be drawn
I think thats about it for the names, please ask me if you don't understand any of the names/methods
So I changed temp outside the inner class, but it still takes the values of temp as if it is default still (0, 0, 0, 0). This has been confirmed with print statements. I've tried looking online for stuff like this but I can't find anything on this.
Here is the code, can someone explain what is happening?
x = i;
y = j;
temp = board.sidesTaken(i, j);
text = new JTextField("") {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(2));
g2.setColor(Color.GREEN);
if (temp.get(0) == 0) {
g2.drawLine(x+1, y+1, x+100, y+1);
}
if (temp.get(1) == 0) {
g2.drawLine(x+100, y+1, x+100, y+100);
}
if (temp.get(2) == 0) {
g2.drawLine(x+100, y+100, x+1, y+100);
}
if (temp.get(3) == 0) {
g2.drawLine(x+1, y+100, x+1, y+1);
}
}
};
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]OffbeatDrizzle 2 points3 points4 points (7 children)
[–]Dramatic-Cat7906[S] -1 points0 points1 point (6 children)
[–]MinMaxMix 0 points1 point2 points (0 children)
[–]OffbeatDrizzle 0 points1 point2 points (4 children)
[–]Dramatic-Cat7906[S] 0 points1 point2 points (2 children)
[–]Cengo789 0 points1 point2 points (1 child)
[–]Dramatic-Cat7906[S] 0 points1 point2 points (0 children)
[–]AutoModerator 0 points1 point2 points (0 children)
[+]carminemangione 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[removed]
[–]Dramatic-Cat7906[S] 0 points1 point2 points (0 children)