ciao ragazzi cerco di creare una array di bottoni in un form , non capisco dove' il problema ,
se elimino la routine(for) il bottone viene creato ,se la tengo no ....
ciao![]()
import javax.swing.JButton;
import javax.swing.JFrame;
public class form {
public static void set() {
int a= 1 ;
String nome[] = new String[10] ;
nome[1]="primo progetto java";
JFrame p = new JFrame();
JButton bott[] = new JButton[10];
p.setSize(250,250);
p.setName(nome[1]);
p.setTitle(nome[1]);
p.setVisible(true);
p.setLayout(null);
for(int i=0;i<bott.length;i++){
a = a + 10;
bott[i].setSize(50,50);
bott[i].setLocation(a,20);
bott[i].setText("a");
p.add(bott[i]);
}
p.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
p.add(p);
}
public static void main(String[] args){
set();
}