You are on page 1of 1

//Use adapter classes to write an applet those changes to cyan while the mouse is being //dragged.

At all other times the applet should be white. import java.awt.*; import java.awt.event.*; import java.applet.*; /* <applet code="adap" height=100 width=100> </applet> */ public class adap extends Applet { public void init() { addMouseMotionListener(new myadap(this)); } } class myadap extends MouseAdapter { adap d; public myadap(adap d) { this.d=d; } public void mouseDragged(MouseEvent me) { d.setBackground(Color.cyan); d.showStatus("cyan"); } }

You might also like