Answer to Question #201097 in Java | JSP | JSF for Hamza

Question #201097

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();

}

}


1
Expert's answer
2021-05-31T05:38:57-0400
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();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS