public class threadexercise extends JFrame{
public threadexercise()
{
}
public static void main(String args[])
{
threadexercise tf = new threadexercise();
tf.setSize(200, 300);
tf.setVisible(true);
int i = 0;
try
{
while(true)
{
Color color = new Color(i);
tf.getContentPane().setBackground(color);
Thread.sleep(1500);
i += 50;
}
}
catch(InterruptedException e)
{
System.out.println("123");
}
}
}