So in my class that extends JPanel I have:
`class Pane extends JPanel {
public static final int MAX_X = 10; //Width
public static final int MAX_Y = MAX_X; //Height
private static final int CELL_WIDTH = 50;
private static final int PREF_W = CELL_WIDTH * MAX_X;
private static final int PREF_H = CELL_WIDTH * MAX_Y;
private static final Color FILL_COLOR = Color.red;
static final Color GEM_COLOR = Color.blue;
}`
@Override
protected void paintComponent(Graphics g) {
g.setColor(FILL_COLOR);
g.fillRect(x * CELL_WIDTH, y * CELL_WIDTH, CELL_WIDTH, CELL_WIDTH);
}
What I want to do is outside of this class at location x and y, retrieve the color while traversing through the panel. Help would be much appreciated, Thank you!