fillR(g, 100, 100, 100, blueCor);
{
else if (imgID == 3)
}
fillR(g, 200, 200, 100, blackCor);
fillR(g, 100, 200, 100, blueCor);
fillR(g, 200, 100, 100, cyanCor);
fillR(g, 100, 100, 100, greenCor);
{
else if (imgID == 2)
}
fillR(g, 200, 200, 100, blueCor);
fillR(g, 100, 200, 100, greenCor);
fillR(g, 200, 100, 100, blackCor);
fillR(g, 100, 100, 100, cyanCor);
{
else if (imgID == 1)
}
fillR(g, 200, 200, 100, greenCor);
fillR(g, 100, 200, 100, cyanCor);
fillR(g, 200, 100, 100, blueCor);
fillR(g, 100, 100, 100, blackCor);
}
showpic = 0;
if (showpic > 3)
showpic++;
pause(1000);
repaint();
imgID = showpic;
{
while (bPlay = true)
int showpic = 0; {
public void run() }
g.fillRect(x, y, length, length);
g.setColor(color); {
public static void fillR(Graphics g, int x, int y, int length, Color color) }
}
fillR(g, 200, 200, 100, cyanCor);
fillR(g, 100, 200, 100, blackCor);
fillR(g, 200, 100, 100, greenCor);
public void stop() }
}
show.start();
bPlay = true;
show = new Thread(this);
{
if (show == null) {
public void play() }
}
e.printStackTrace();
{
catch (InterruptedException e)
}
Thread.sleep(time);
{
try {
public void pause(int time) }
}
}
return false;
else
return true;
if (show != null) {
public boolean isPlay() }
}
bPlay = false;
show = null;
{
if (show != null) {
7、在窗口的一个区域进行鼠标操作:mouseEnter,mouseExit、 mousePress,mouseDrage、mouseClick。在窗口的另一个区域以文字显不鼠标所进 行的相应操作。另外当鼠标进行mousePress、mouseDrage、mouseClick操作时, 将显示一个图片。当鼠标拖拉时,图片随鼠标移动。
package com.devon.demo01;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MyClass {
private JFrame fm = new JFrame(\鼠标移动示例\);