Button error (awt)

I try to do this ...

Button tasti[1000] =null;

for(int e=0;e<1000;e++) tasti[e] =new Button();

for(int i=0;i<1000;i++) f.add(tasti[i]);

But netbeans give me to me an error at the first line.....

how can i create a Button vector with 1000 Button ?

[489 byte] By [originofa] at [2007-10-3 1:35:36]
# 1

I'm guessing that f is already declared something like:

ArrayList<JButton> f = new ArrayList<JButton>();

try this and put it all in one loop if you like...

JButton[] tasti = new JButton[1000];

// instead of: JButton tasti[1000] = null;

for(int e=0;e<1000;e++)

{

tasti[e] = new JButton();

f.add(tasti[e]);

}

Banana.Foo.Fooa at 2007-7-14 18:33:40 > top of Java-index,Desktop,Developing for the Desktop...