public void updateSensorView() { int x, y, h; String s = ""; for (x = 0; x < rows; x++) { for (y = 0; y < cols; y++) { s = ""; for (h = 1; h < 5; h++) { states[x][y][h].setText(s); states[x][y][h].setBackground(Color.white); } states[x][y][0].setBackground(Color.white); s += "" + loc.getOrXY(sXCount, sYCount, x, y); states[x][y][0].setText(s); } } states[sXCount][sYCount][4].setBackground(Color.cyan); if (++sYCount == cols) { sYCount = 0; if (++sXCount == rows) { sXCount = 0; } } }