Problem

Playing CompilerFind and correct the syntax and logic errors in the following program, whi...

Playing Compiler

Find and correct the syntax and logic errors in the following program, which is supposed to display an image in the center of a frame, the words “huh?” and “what?” in the EAST and WEST sections of the frame, respectively, the digits 0 through 9 from left to right in the NORTH section, and the digits 9 through 0 from left to right in the SOUTH section.

    import javax.swing.*;    import java.awt.*;    public class BorderLayoutExample extends JFrame    {       public BorderLayoutExample()       {          super("Border Layout Example");          setBounds(0, 0, 300, 300); // for the frame          JPanel bottomPanel = new JPanel (new (GridLayout()) );          JPanel topPanel = new JPanel (new (GridLayout()) );            for (int i = 0; i<10; i++)                 {                   bottomPanel.add (new JLabel(i));                   bottomPanel.add (new JLabel(10 − i));                 }          add(bottomPanel, BorderLayout.SOUTH);          add(topPanel, BorderLayout.NORTH);          add(new String ("huh?"), BorderLayout.EAST);          add(new String ("what?"), BorderLayout.WEST);          JLabel picture = new JLabel(new ImageIcon("test.jpg"));          add(picture, BorderLayout.CENTER);    }    public static void main(String[] args)      {          JFrame frame = new BorderLayoutExample();          frame.setVisible(true);          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