if("switch".equals(action))
{
changeLunar();
count++;
if (count % 2 == 0)
{
lunarButton = new JButton(new ImageIcon("assets/sun.png"));
}
else
{
lunarButton = new JButton(new ImageIcon("assets/moon.png"));
}
}
So I am trying to make it where when you click a button, the button changes to another image, and when you click it again it goes back to the first image. But when I compile it says:
lunarButton can't be resolved to a variable
What am I to do?