Hi, I'm making a board game where the player chooses the colour of their counters at the start. However, I am having trouble using the response to the 'Choose your first colour' and making it change the image of the counter, as it says that the non-static method cannot be referenced from a static context.
Here is the method in my 'Text' class that asks the user which colour they would like for their first counter and uses the response to change the image of the Counter class actor Here are the methods for the Counter class that should change the image
Thanks in advance!
public void P1Counter1()
{
Object[] selectionValues = { "Red", "Green", "Yellow", "Blue" };
String initialSelection = "Blue";
String s = (String) JOptionPane.showInputDialog(null, Player1Name+", choose your 1st colour!",
"Colour", JOptionPane.QUESTION_MESSAGE, null, selectionValues, initialSelection);
if (s=="Red")
{
Counter.Red();
}
if (s=="Yellow")
{
Counter.Yellow();
}
if (s=="Green")
{
Counter.Green();
}
if (s=="Blue")
{
Counter.Blue();
}
} public void Red()
{
setImage("Counter1.png");
}
public void Blue()
{
setImage("Counter2.png");
}
public void Yellow()
{
setImage("Counter3.png");
}
public void Green()
{
setImage("Counter4.png");
}
