Microsoft Visual J++. Java


- 4


dimAppWndDimension = Appl.size();

}

 

// -------------------------------------------------------

// run

// ,

//

// ,

// -------------------------------------------------------

public void run()

{

while (true)

{

int x, y, width, height;

int rColor, gColor, bColor;

//

//

x = (int)(dimAppWndDimension.width * Math.random());

y = (int)(dimAppWndDimension.height * Math.random());

width = (int)(dimAppWndDimension.width *

Math.random()) / 2;

height = (int)(dimAppWndDimension.height *

Math.random()) / 2;

//

rColor = (int)(255 * Math.random());

gColor = (int)(255 * Math.random());

bColor = (int)(255 * Math.random());

 

//

//

g.setColor(new Color(rColor, gColor, bColor));

 

//

g.fillOval(x, y, width, height);

 

// 50

try

{

Thread.sleep(50);

}

catch (InterruptedException e)

{

stop();

}

}

}

}

1.6 HTML, .

1.6. MultiTask2\ MultiTask2.html

<html>

<head>

<title>MultiTask2</title>

</head>

<body>

<hr>

<applet

code=MultiTask2.class

id=MultiTask2

width=320

height=240 >

</applet>

<hr>

<a href="MultiTask2.java">The source.</a>

</body>

</html>