Question
/** * q2: Write a public class named InquiryMouseListener that implements the MouseListener * interface. This class will have a public constructor that takes a
/** * q2: Write a public class named InquiryMouseListener that implements the MouseListener * interface. This class will have a public constructor that takes a JComponent as a * parameter and stores it in an instance variable. Implement the appropriate MouseListener * methods such that the foreground color of the stored JComponent will change to * Color.LIGHT_GRAY when the mouse enters the component, Color.CYAN when the mouse exits the * component, and Color.YELLOW when the component is clicked. After the component has been * clicked is should remain with a foreground of Color.YELLOW regardless of any mouse actions * in the future (Hint: You can do this with a boolean instance variable that tracks whether * of not the component has been clicked). * * Then write a public method in the Problem Set class named mouseComponents_246 that takes * no parameters and returns a new JPanel containing a new JComboBox, and a JButton each with * a different instance of InquiryMouseListener added to it with itself as the JComponent for * the listener. That is, when calling the constructor for InquiryMouseListener the input * should be the component to which the instance will be added. * * You can/should add this JPanel to a JFrame in your main method to verify the proper * functionality */
PLEASE HELP ME, GIVE ME A RIGHT ANSWER, THANK YOU !!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started