Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following Java program. Describe what it does in response to specific operations of the mouse, and how it does it. (You are encouraged

Consider the following Java program. Describe what it does in response to specific operations of the mouse, and how it does it. (You are encouraged to run the program for yourself to test its behavior. Then read through the program carefully to understand how that behavior arises.)

import java.awt.event.*;

importjavax.swing.*;

public class MouseWhisperer extends JFrame implements MouseListener {

MouseWhisperer() {

super("COME CLOSER");

setSize(300,100);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

addMouseListener(this);

setVisible(true);

}

public void mouseClicked(MouseEvent e) { setTitle("OUCH"); }

public void mousePressed(MouseEvent e) { setTitle("LET GO"); }

public void mouseReleased(MouseEvent e) { setTitle("WHEW"); }

public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }

public void mouseExited(MouseEvent e) { setTitle("COME CLOSER"); }

public static void main(String[] args) { new MouseWhisperer(); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Unity From Zero To Proficiency Beginner A Step By Step Guide To Coding Your First Game

Authors: Patrick Felicia

1st Edition

1091872023, 978-1091872028

More Books

Students also viewed these Programming questions

Question

Describe the error. Sin / cos(- ) = sin / - cos = - tan

Answered: 1 week ago

Question

Cara yang digunakan untuk membuat thread dalam java

Answered: 1 week ago