Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Fortune Teller Lab Goals: 1. Practice using Swing to create Graphical User Interfaces. 2. Learn to use the online Java documentation to figure out how
Fortune Teller Lab Goals: 1. Practice using Swing to create Graphical User Interfaces. 2. Learn to use the online Java documentation to figure out how to do things that I have not shown you directly. - Instructions: 1. In the Fortune Teller GUI project, create a fortune Teller class based on the following UML Fortune Teller + fortunes:ArrayList + Fortune Teller(fortunes: ArrayList) + addFortune(fortune: String) + getRandomFortune() Diagram. o prepopulate the Fortune Teller ArrayList with at least 12 humorous fortunes. o Make sure that you implement the getRandome Fortune method in a way that wouldn't return the same fortune as the last one presented. To be clear, the program will repeat fortunes just not the same one twice in a row. . (Hint: remember the index of the current fortune and when you generate a new random index, make sure that it is different from the previous one.) 2. Modify the Fortune TellerFrame.java class so it inherits from JFrame. 3. Create the components and configure the Layout to achieve the following: The application frame is 500 points wide, and 400 tall. The application Frame will contain 3 panels (top, middle, bottom - Which means there's a fourth that contains them all) Top Panel: Contains a JLabel with text "Fortune Teller" and an ImageIcon (an image is already included in the assets folder) The JLabel has a constructor that takes a String and the Imagelcon. A link to the docs is here Change the Label fontFace to .... and set the size to 36. Middle Panel: A JTextArea within a JScrollpane where the fortunes will be displayed one per line. Again, set the font values so that it works. (Should be smaller than the large text of the Top panel.) Bottom PanelThis panel will have 2 buttones: A button with the label "Read My Fortune!". And another with the label "Quit 4. When the user clicks on the "Read My Fortune" button, the application should call the getRandomFortune method of the Fortune Teller class. Note that the textArea will display all the fortunes that the user receives one after another and then will be scrollable. 5. Use the Java 8 Lambda Expressions for the actionListner of the quit button. Outcome ooo Another title FO Fortune Teller A secret admirer will soon send you a sign of affection. Your heart is in a place to draw true happiness. A thrilling time is in your near future. The one you love is closer than you think. Plan for many pleasures ahead. Something you lost will turn up soon. Quit R ead my Fortune
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