Question
The first image is my current code for my task. The second image is the way I am calling it. My task is 1) Create
The first image is my current code for my task. The second image is the way I am calling it.
My task is
1) Create a class named FramedPanel that extends JPanel. The class should have one private member variable named color (of type Color).
2) There should be a single constructor that takes a Color parameter and sets the variable color to equal the parameter.
3) You should override the paintComponent method inherited from JPanel.
4) The overridden paintComponent method should outline the panel in a border that is the same color as the private variable color. The thickness of the border should be whichever is less: 1/20 of the width of the panel or 1/20 of the height of the panel.
5) The central area of the panel should be white. There should be a thin black line dividing the border from the white center.
6) Modify your PlainPanel code from the previous assignment (6.1) to place a red FramedPanel in the CENTER position of the PlainPanel. (You should only need to add one line of code to the PlainPanel file, and is demonstrated at the beginning of the video link above)
7)Use the PlainPanelMain file from the previous assignment (or create your own runner class) to see what the panel looks like.
ALL CODE ARE IN JAVA.
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