Computer Science, asked by aman1762004shaikh, 3 months ago

write a program to change thw background color of Applet When user performs events using mouse​

Answers

Answered by itsmepapakigudiya
0

Answer:

Background Colour of Applet by ...

We have to write a program in Java such that it changes the background color of the frame to a random ... /*Java Program to Change Background Color of Applet*/ ... import java.awt .

Answered by Aayushimaurya2
1

Answer:

import java.awt.*;

import java.applet.*;

import java.awt.event.*;  

public class MouseColor1 extends Applet implements MouseMotionListener

{

  public void init()

   {

       addMouseMotionListener(this);

   }

   public void mouseDragged(MouseEvent me)

   {

       setBackground(Color.red);

       repaint();

   }

  public void mouseMoved(MouseEvent me)

   {

       setBackground(Color.green);

     repaint();

   } 

}

Similar questions