import java.awt.Color;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
* @author Amol
*/
public class ContF extends JFrame{
public ContF() throws HeadlessException {
super("Test Frame");
setBackground(Color.red);
setLayout(new GridLayout(7,7,2,2));
for (int i = 0; i < 49; i++) {
JPanel jp = new JPanel();
jp.setBackground(new Color((int)(Math.random()*167714544)));
add(jp);
setSize(400,400);
setVisible(true);
}
}
public static void main(String[] args) {
new ContF();
}
}
No comments:
Post a Comment