Short Answer
import javax.swing.*;
import java.awt.*;
public class JDemoGridLayout extends JFrame
{
private JButton b1 = new JButton("Button 1");
private JButton b2 = new JButton("Button 2");
private JButton b3 = new JButton("Button 3");
private JButton b4 = new JButton("Button 4");
private JButton b5 = new JButton("Button 5");
-----Code here-----
private Container con = getContentPane();
public JDemoGridLayout()
{
con.setLayout(layout);
con.add(b1);
con.add(b2);
con.add(b3);
con.add(b4);
con.add(b5);
setSize(200, 200);
}
public static void main(String[] args)
{
JDemoGridLayout frame = new JDemoGridLayout();
frame.setVisible(true);
}
}
Using the above code, write the statement in the indicated line to establish a GridLayout with three horizontal rows and two vertical columns, with horizontal and vertical gaps of five pixels each.
Correct Answer:

Verified
private GridLayout l...View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q1: import java.awt.*; <br>import javax.swing.*; <br>import java.awt.Color; <br>public
Q2: The wildcard in the import java.awt.* statement
Q3: What is the parent class of JPanel
Q4: When do you need to worry about
Q5: Which of the following statements will correctly
Q7: _ are lists of user options; they
Q8: The focusGained(FocusEvent) handler is defined in the
Q9: A BorderLayout is arranged in north, south,
Q10: A(n) _ is a tree of components
Q11: import javax.swing.*; <br>import java.awt.*; <br>public class JDemoBorderLayout