Thanks, guys. Also, I'm having a bit of a problem trying to set out my initial layout again. I had the 10x10 grid set up, but I also needed to add three labels/buttons on top of the grid, and it's throwing me off a little bit.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Ex3_1 extends JApplet
{
int numButtons;
String s;
private JButton b = new JButton("start over");
private JLabel l1 = new JLabel("attempts: ");
private JLabel l2 = new JLabel("found: ");
private JPanel p1, p2;
private GridLayout grid1;
private Container pane;
public void init()
{
Container pane = getContentPane();
pane.setLayout(new GridLayout(1, 1, 0, 5));
JPanel top = new JPanel();
top.setLayout(new FlowLayout());
top.add(l1);
top.add(l2);
top.add(b);
JPanel bottom = new JPanel();
bottom.setLayout(new FlowLayout());
s = getParameter("NUMBUTTONS");
numButtons = Integer.valueOf(s).intValue();
grid1 = new GridLayout(10, 10);
for (int i=1; i<=numButtons; i++ )
bottom.add(new Button("") );
pane.add(top);
pane.add(bottom);
}
}
With this code, I have the three buttons on the left and a distorted grid on the right side of the panel. I think trying to put the grid on a panel is throwing it all off, am I going about this all wrong?