Question 1: Define a JFrame subclass named Question1 that has one pushbutton. Initially, the background color is white (Color.WHITE) and the button’s text is ON. When the button is clicked, the background of the frame changes to yellow (Color.YELLOW) and the text of the button changes to OFF. If the button is clicked again, the frame returns to the initial state (ON button text and white background color). Because the button text switches back and forth between ON and OFF, such button is called a toggle switch. Closing the frame window terminates the program
Question 2: In Example 40 – JtextField, event handling was done within its class. Modify a new class Question2 so that the button listener is not changed, but the text events are handled by a separate TextHandler class named Q2textHandler. You can use the ButtonHandler class from the PowerPoint as a guide, but you should make your own TextHandler class and associate it with the JTextField.
Question 3: Write a Question3 class with the following menu bar and choices:
File Edit Color
Quit Erase Red
When the user selects Quit, stop the program. When the user selects one of the colors, change the background of the frame ( the content pane) to the selected color. When the user selects erase, reset the background color to white. You can (and should) use the code from Example 48 to help you
Question 4: Using a layout, create a class Question4 that displays N prime numbers where N is a value entered in a text field. A prime number is an integer greater than 1 and divisible by only itself and 1. Your GUI should include a) a text field to enter the number of primes to display b) a button to generate those primes, and c) a JTextArea of JList (scroll bar optional) to display this list. Use any layout you wish. Please include an image of your choice to make the GUI look nice!
Question 5: Give Assignment 1 a GUI interface of your choosing and name the class Question5. The user should be able to enter information into the GUI and the point value should be displayed to the user through the GUI in some way as well. Format, style, color, borders, etc. are all up to you.Attachments