If you set the layout manager to null you would have to use absoulte positioning. Once the layout manager is set to null there are multiple ways you could position your component. You could use any of the following methods depending on your needs. setLocation(Point p), setLocation(int x,int y), setBounds(int x, int y, int width, int height), setBounds(Rectangle r). Using this approach can get quite complicate though and as far as sun says shouldn't be done due to how other platforms might render you components.
Here is an example that i whipped up which uses absoulte positioning.
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Layout{
public static void main(String [] args){
int height = 50;
int width = 50;
int space = 10;
int x = 0;
int y = 10;
JFrame jf = new JFrame("Layout Example");
Container c = jf.getContentPane();
c.setLayout(null);
jf.addWindowListener(new WindowMonitor());
jf.setSize(700,400);
jf.setResizable(false);
jf.setVisible(true);
JButton[] jb = new JButton[54];
for(int i = 0; i < jb.length; ++i){
jb[i] = new JButton(new Integer(i).toString());
jb[i].setSize(width, height);
}
for(int i = 0; i < jb.length; ++i){
if(x == 0){
x = 10;
jb[i].setBounds(new Rectangle(x, y, width, height));
c.add(jb[i]);
continue;
}
x += (width + space);
jb[i].setBounds(new Rectangle(x, y, width, height));
c.add(jb[i]);
if(x > (jf.getWidth() - (width + space))){
x = 10;
y += (height + space);
jb[i].setBounds(new Rectangle(x, y, width, height));
c.add(jb[i]);
}
}
}
}
class WindowMonitor extends WindowAdapter {
public void windowClosing(WindowEvent we){
System.exit(0);
}
}