Question
Create a class called BrainLobeGUI. This class should extend JComponent. Create a class called Lobe. Create a class called MainLobeGUI. This class should contain a
Create a class called BrainLobeGUI. This class should extend JComponent. Create a class called Lobe.
Create a class called MainLobeGUI. This class should contain a main method.
You may add any number of variables, methods or other classes you find helpful.
Add private variables to the Lobe class the contain information defining one of the lobes. The required information is the name, the colour, the coordinates, the width and the height. Override the toString method to print the name of the lobe.
Add a private variable of type List to BrainLobeGUI. This variable should contain all the lobes that will be visualised.
Add a public method called addLobes that returns void and has no parameters. In this method create a lobe variable for Frontal Left, Frontal Right, Parietal Left, Parietal Right, Occipital Left and Occipital Right. When choosing the coordinates assume you are viewing the brain from above.
Add a paintComponent method and visualise all the lobes you created in addLobes. Add a BrainLobeGUI object to a JFrame and display it using the main method in MainLobeGUI. .
Add a MouseListener to BrainLobeGUI. Whenever the left mouse button is clicked print the name of the lobe that was clicked (if over a lobe) or nothing (if not over a lobe).
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
class Lobe private String name private Color color private in...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