Explanation of Solution
 Modified code:
//import required header files
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//definition of "visibilityDemo" class
public class VisibilityDemo extends JApplet implements ActionListener
{
    //declare the required variables
    private JLabel response;
    private Container contentPane;
    private JButton aButton;
    //definition of "init()" method
    public void init( )
    {
        //create content pane
        contentPane = getContentPane();
        //set the background color
        contentPane.setBackground(Color.WHITE);
        //create a button
        aButton = new JButton("Push me!");
        //add the action listener to the button
        aButton.addActionListener(this);
        //create a label
response = new JLabel("Thanks. That felt good!");
        //create an object for "ImageIcon"
ImageIcon smileyFaceIcon = new ImageIcon("smiley.gif");
        //display the icon on the window
        response.setIcon(smileyFaceIcon);
        //hide the label until a button is clicked
        response...
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education