Problem

Playing CompilerFind the errors in the following program, which is supposed to display a p...

Playing Compiler

Find the errors in the following program, which is supposed to display a picture of a smile with the heading “Smile”.

     import javax.swing.*;     public class MySecondFrame extends JFrame     {       public MySecondFrame ()       {          add(new JButton("Smile"), BorderLayout.NORTH);             // adds image of smile          add(new IconImage(“smile.jpg”, BorderLayout.CENTER);       // in center with heading          setBounds(0,0,300,3                                        // below       }       public MySecondFrame (String title)      {          super(title);          setBounds(0, 0, 300, 300);      }    }

The following test class creates, displays, and closes a MySecondFrame frame.

    import javax.swing.*;    public class TestMySecondFrame    {      public static void main(String[] args)      {        JFrame frame = new MySecondFrame ("This is a test");        frame.setVisible(true);        frame.setResizable(false);        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      }    }

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 18
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT