【发布时间】:2017-12-29 06:20:33
【问题描述】:
我正在制作一个“来自地狱的 GUI”,并且我正在尝试让 JFrame 闪烁颜色(快速更改背景)足够长的时间以令人讨厌。这就是我所拥有的:
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);
}
注意:如果您知道如何轻松地使整个 JFrame 及其所有内容更改颜色(不仅仅是背景),那将是疯狂而令人敬畏的,所以让我们一起来看看吧。
感谢任何指导!希望我没有错过一些愚蠢的事情......
...如果您对荒谬的 GUI 效果有一两个想法,请随时分享! :)
【问题讨论】:
-
只是为了确保您考虑到这一点:en.wikipedia.org/wiki/Photosensitive_epilepsy
-
+1 用于从地狱中设计 GUI。
-
根据图片的不同,
ImageLabelPanel可能会相当令人不安。