Question
This should be solved using 2 files. The tester will get the user data and then create a Panel with the user data and add
This should be solved using 2 files. The tester will get the user data and then create a Panel with the user data and add it to a JFrame, Important, this needs to be written so that the there is a separate input dialog loop for each color.
Ask the user to enter 3 values 1 for a red value, 1 for a green value and 1 for a blue value
Have the user enter the colors in the order Red, Green, Blue...use JOptionPane.showInputDialog with informative prompts so they know which color value is being entered.
Values must be between 0 and 255.
Force the user to enter a valid number. Input dialogs only input Strings The input then needs to be parsed as an integer ( Integer.parseInt( userInput ). Integer.parseInt will throw an Exception if non-integer data is parsed. Catch the Exception if thrown. Here is the general structure.
Do {
Try {
Get Color value via Inputdialog
Parse string color value to Int
If value > -1 and < 256 {
Breakout of loop
}
Catch Format exception {
Inform user
}
} End loop
You will need a separate input dialog loop for each color.
Once all 3 numbers have been entered then create a Java GUI that will have the background color that the user requested by the values entered.
Make the GUI 400 by 250
GUI title should be: yourName where yourName is your name! Ask the user for their name
Text on the GUI should read: Adventures in Programming
The text color must be different from the background (or you wont be able to see it). Use techniques that were demonstrated to achieve this.
The text should not be default color or size
Center the text in the middle of the GUI
Center the GUI in the center of the screen
Have the application close when the user exits the GUI.
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