|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have an applet have a panel with GridLayout with 5 rows and 5 cols. I want to place 4 first rows with TextField using for loop but it can't initialize. What can I do?
The code is like that: public class Puzzle extends Applet { Panel pan; TextField[] tf1; TextField[] tf2; TextField[] tf3; TextField[] tf4; public void init() { pan=new Panel(); pan1.setLayout(new GridLayout(5,5,10,10)); for(int i=0;i<5;i++) { tf1[i]=new TextField(); pan1.add(tf1[i]); } for(int i=0;i<5;i++) { tf2[i]=new TextField(); pan1.add(tf2[i]); } for(int i=0;i<5;i++) { tf3[i]=new TextField(); pan1.add(tf3[i]); } for(int i=0;i<5;i++) { tf4[i]=new TextField(); pan1.add(tf4[i]); } add(pan1); } } |
|
#2
|
|||
|
|||
|
Unless I'm drunk and am missing the obvious (which is a possibility
), the code doesn't look wrong... Are you receiving any error messages when compiling?
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > What can I do to declare an array of TextField? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|