Correct the syntax errors in the following program:
public class RTwo extends JFrame
{
public RTwoProgram()
{
private JLabel length, width, area;
setTitle("Good day Area");
length = JLabel("Enter the length);
width = JLabel("Enter the width);
area = JLabel("Area: ");
containerPane = ContentPane();
pane.setLayout(GridLayout(4,1));
setSize(WIDTH,HEIGHT);
setVisible();
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String args[])
{
RTwoProgram R2 = new RTwoProgram();
}
}
import java.awt.Container;
import java.awt.GridLayout;
import javax.swing.*;
public class RTwoProgram extends JFrame {
private JLabel length, width, area;
public RTwoProgram() {
setTitle("Good day Area");
length = new JLabel("Enter the length");
width = new JLabel("Enter the width");
area = new JLabel("Area: ");
Container pane = getContentPane();
pane.setLayout(new GridLayout(4, 1));
setSize(WIDTH, HEIGHT);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]){
RTwoProgram R2 = new RTwoProgram();
}
}
Comments
Leave a comment