does anyone know how to refresh my JFrame so I can display my new JButton ?
private void displayGrid()
{
Case arrayGrid [][] = Grid.returnArray();
for(int i = 0; i < Settings.returnYGrid(); i++)
{
for(int j = 0; j < Settings.returnXGrid(); j++)
{
Case caase = arrayGrid [i][j];
panel.add(caase.getButton());
}
}
Here is the method that I use when I create my JFrame. Then, I want to refresh my JFrame with the same method because some Case in my arrayGrid have changed and nothing is happening at all…
I tried to set revalidate(), repaint() and nothing either.
Try adding a call to
revalidateandrepaintat the end of the method…Updated with working example