How to Change a JLabel in a Frame when a Button is clicked?
I have a JFrame object that has as a field:
ArrayList<JLabel> arrayFullOfLabels = new ArrayList<JLabel>();
I have a method:
void setArrayFullOfLabels()
{
for(int i=0;i<5;i++)
{
arrayFullOfLabels.add(new JLabel(arrayFullOfDiceImages.get(i)));
}
}
And in my constructor somewhere I call this setArrayFullOfLabels..
When I run my JFrame, I see the JLabes just fine..
I also have a button, When I click the button I want the JLabel to change..
mainFrame.arrayFullOfLabels.set(2, new JLabel("WHYYY!!!"));
But it is not working..
Any help?
( The actionListener is working just fine and I have mainFrame.validate() and mainFrame.repaint() )
Re: How to Change a JLabel in a Frame when a Button is clicked?