I'm making a "GUI from Hell", and I'm trying to make the JFrame flash colors (change background rapidly) for a time long enough to be annoying. This is what I've got:
int changes = gen.nextInt(2000) + 5000;
int red;
int green;
int blue;
Color color;
for (int i = 0; i < changes; i++)
{
color = new Color(gen.nextInt(256), gen.nextInt(256),
gen.nextInt(256));
// I first tried this...
frameMain.getContentPane().setBackground(color);
// Then I tried this, which only
// appeared to change the color once and then proclaim
// that it was done:
panel1.setBackground(color);
panel2.setBackground(color);
panel3.setBackground(color);
}
Note: If you know how to easily make the entire JFrame and all of its contents change color (not just the background), that would be crazy and awesome, so let us in on that.
Any guidance is appreciated! Hopefully I haven't just missed something silly...
...and if you have an idea or two for a ridiculous GUI effect, feel free to share! :)