Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA 1410 DESCRIPTION In this assignment, you are going to create a simple GUI application. It includes a button and two labels. The button changes
JAVA 1410
DESCRIPTION
In this assignment, you are going to create a simple GUI application. It includes a button and two labels. The button changes color every time it is clicked, the left label indicates how often the button was red, and the bottom label shows your name.
Example of a finished version: https://youtu.be/9SWEeNfls8E
- The layout of the GUI:
- The GUI is implemented as a JFrame
- The JFrame has the following dimensions: width: 500 and height: 200
- It includes a 'Red Counter' label and a 'Click Me' button that have approximately the same size
- At the bottom there is a label with the following text: {name}'s GUI where {name} is your actual name
- The 'Click Me' Button
- When the GUI opens the button background is blue, and the text is white
- The font is monospaced and fairly large but leaves padding on the sides
- The text is 'Click Me' and it is centered
- The 'Red Counter' Label
- When the GUI opens, the counter displays Red Counter: 00
- The background is light gray
- The font monospaced and the font-size is larger than the default but small enough to comfortably fit in the label without touching the sides
- The Label at the bottom
- The background color is a very light shade of gray. It needs to be visibly lighter than the background of the label above
- The font is different from the other two fonts used before
- The padding on top and on the bottom is approximately the height of a letter
- The Button Click Event
- Every time the button is clicked the background color changes
- There are exactly 5 possible background colors for the button: red, blue, green, orange, or magenta
- Every time the background color happens to be red, the 'Red Counter' on the left is increased by one
- Refactoring
- Extract methods to make the code easy to read and maintain
- Use descriptive names
- Doc Comments
- Include doc comments for the class and for all methods, even the private ones.
- The comments should include meaningful descriptions.
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