Please help me with this using java. A starters code is provided (I created a starters code). For more info refer to the image provided. Please ensure tge code works   Starter code: import javax.swing.*; import java.applet.*; import java.awt.event.*; import java.awt.*; public class halloween extends Applet implements ActionListener {     int hallow[] [] = ?     int rows = 4;     int cols = 3;     JButton pics[] = new JButton [rows * cols];     public void init ()     {         Panel grid = new Panel (new GridLayout (rows, cols));         int m = 0;         for (int i = 0 ; i < rows ; i++)         {             for (int j = 0 ; j < cols ; j++)             {                 pics [m] = new JButton (createImageIcon ("back.png"));                 pics [m].addActionListener (this);                 pics [m].setActionCommand (m + "");                 pics [m].setPreferredSize (new Dimension (128, 128));                 grid.add (pics [m]);     } } m++; } } add (grid); } public void actionPerformed (ActionEvent e) {     if (e.getActionCommand ().equals ("Reset"))     {         for (int m = 0 ; m < pics.length ; m++)             pics [m].setIcon (createImageIcon ("back.png")); } else {         int n = Integer.parseInt (e.getActionCommand ());         int x = n % rows;         int y = n / rows;         pics [n].setIcon (createImageIcon ("hal" + hallow [x] [y] + ".png")); } } protected static ImageIcon createImageIcon (String path) { java.net.URL imgURL = halloween.class.getResource (path); if (imgURL != null)     return new ImageIcon (imgURL); else return

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please help me with this using java. A starters code is provided (I created a starters code). For more info refer to the image provided. Please ensure tge code works

 

Starter code:
import javax.swing.*; import java.applet.*; import java.awt.event.*; import java.awt.*;
public class halloween extends Applet implements ActionListener
{
    int hallow[] [] = ?
    int rows = 4;
    int cols = 3;
    JButton pics[] = new JButton [rows * cols];
    public void init ()
    {
        Panel grid = new Panel (new GridLayout (rows, cols));
        int m = 0;
        for (int i = 0 ; i < rows ; i++)
        {
            for (int j = 0 ; j < cols ; j++)
            {
                pics [m] = new JButton (createImageIcon ("back.png"));
                pics [m].addActionListener (this);
                pics [m].setActionCommand (m + "");
                pics [m].setPreferredSize (new Dimension (128, 128));
                grid.add (pics [m]);
   
} }
m++; }
}
add (grid); }
public void actionPerformed (ActionEvent e)
{
    if (e.getActionCommand ().equals ("Reset"))
    {
        for (int m = 0 ; m < pics.length ; m++)
            pics [m].setIcon (createImageIcon ("back.png"));
} else {
        int n = Integer.parseInt (e.getActionCommand ());
        int x = n % rows;
        int y = n / rows;
        pics [n].setIcon (createImageIcon ("hal" + hallow [x] [y] + ".png"));
} }
protected static ImageIcon createImageIcon (String path)
{
java.net.URL imgURL = halloween.class.getResource (path);
if (imgURL != null)
    return new ImageIcon (imgURL);
else
return 

Freedom LTE (VPN)
X
back.png
OO
11:05 AM
hall.png
Halloween
1. Add the array to make these pictures.
2. Add a reset button. Change its font and color. Its action Command must be "Reset
3. Add a title. Change its font.
Halloween Matching
85
hal2.png hal3.png
hal4.png
52%
hal5.png
hal6.png
000
Transcribed Image Text:Freedom LTE (VPN) X back.png OO 11:05 AM hall.png Halloween 1. Add the array to make these pictures. 2. Add a reset button. Change its font and color. Its action Command must be "Reset 3. Add a title. Change its font. Halloween Matching 85 hal2.png hal3.png hal4.png 52% hal5.png hal6.png 000
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education