Question & Answer: Need this and everything exactly. Thank you!…..

Need this and everything exactly. Thank you!

We are going to re-do the SuperLottoPlus assignment, and turn it into a Java swing application Create a new class called that extends JFrame.

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Need this and everything exactly. Thank you!…..
Order Essay

Create the GUI Set the window title to “SuperLottoPlus” (10 point)

Create two JPanel objects (north and center panel) (10 point)

Using BorderLayout, set the position of the north and center panel(10 point)

Add 3 JButtons to the north panel: “I’m Feeling Lucky”, “Reset”, and “Print” (10 point)

Made the north panel background color orange (10 point)

Add a text area box (JTextArea) to the center panel (this is where we will display the lotto numbers) (10 point)

When the user clicks the “I’m Feeling Lucky” button: Make the center panel background yellow (10 point)

Display the SuperLotto lottery numbers in the text area box. (10 point)

When the user clicks the “Reset” button, make the center panel background white, and clear the text. (10 point)

When the user clicks the “Print” button, write whatever text is in the center panel to a file called “superlotto.txt” (10 point)

Expert Answer

Java Code
package superlotto.GUI;

import java.awt.BorderLayout;

import java.awt.EventQueue;

import javax.swing.JFrame;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import java.awt.Color;

import javax.swing.JTextArea;

import javax.swing.JButton;

import java.awt.event.ActionListener;




import java.awt.event.ActionEvent;

public class SuperLottoSwing extends JFrame {

private JPanel contentPane;

private JTextArea textArea_lottoNum;

// lotto numbers array.

private String[] lottoNumbers = {“8242632441”, “94638782387”, “23465891643”, “35267459824”,

“18953286794”, “91645278542”, “43675489023”};


* Launch the application.


public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

SuperLottoSwing frame = new SuperLottoSwing(“SuperLottoPlus”);


} catch (Exception e) {







* Create the frame.


public SuperLottoSwing(String title) {



setBounds(100, 100, 450, 300);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

contentPane.setLayout(new BorderLayout(0, 0));


JPanel NorthPanel = new JPanel();


contentPane.add(NorthPanel, BorderLayout.NORTH);

JPanel CenterPanel = new JPanel();

contentPane.add(CenterPanel, BorderLayout.CENTER);

textArea_lottoNum = new JTextArea(5, 20);



// Button I am feeling lucky

JButton btn_feelingLucky = new JButton(“I’m Feeling Lucky”);

btn_feelingLucky.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {


for(String num : lottoNumbers)





//Button Reset

JButton btn_reset = new JButton(“Reset”);

btn_reset.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

CenterPanel.setBackground(Color.decode(“#f0f0f0”)); // setting to default color





// Button Print

JButton btn_print = new JButton(“Print”);

btn_print.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {







* Method to print to file


public void printToFile()



FileWriter fw = null;

try {

fw = new FileWriter(new File(“superlotto.txt”));

for(String num : lottoNumbers)

fw.write(num+”n”); // printing to file


JOptionPane.showMessageDialog(null, “Lotto Numbers printed to file succesfully.”);


catch (IOException e1) {

JOptionPane.showMessageDialog(null, “Error in creating the ‘superlotto.txt’ file”, “ERROR”, JOptionPane.ERROR_MESSAGE);




JOptionPane.showMessageDialog(null, “Nothing in Text Area to print”);



Instructions: Open your java ide create a new project with package name superlotto.GUI and within this package create a new class named SuperLottoSwing after than copy-paste the above code into the class file and run.


Grand Paper Writers
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All papers are written by the best professional writers to ensure 100% originality. We always provide plagiarism reports whenever we deliver completed papers.

Free Revisions

All papers by Grand Paper Writers are completed and submitted on time. This timely delivery of papers gives you time to go through the paper before the official deadline.


As an additional service, we will provide a title page that precedes the contents of your paper. Here, you will provide your personal details.


We also ensure that we provide an extra page for the references or bibliographies following referencing rules.

Originality & Security

At, we guarantee students for the provision of security and original work. All your personal information is handled with confidentiality and is not shared with third parties. Additionally, we ensure that we provide original content with accompanying plagiarism reports to show originality.

24/7 Customer Support

Our customer support team is always available 24/7 to provide instant responses to any queries raised by students.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services has the best professional essay writers for quality services.


Flexible Pricing

Here, a, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.


Admission Help & Client-Writer Contact provides an interactive portal where students can communicate directly to their writers.


Paper Submission

Here, a, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.


Customer Feedback appreciates feedback from our clients to help us improve the delivery of essay writing services. As such, we are constantly changing our policies to ensure maximum customer and writer satisfaction.