---
title: "Make a string of JTextField variable"  
description: "Make a string of JTextField variable"  
author: "Mark Devid"  
published: 2015-12-27  
updated: 2015-12-27  
canonical: https://www.mindstick.com/forum/33793/make-a-string-of-jtextfield-variable  
category: "java"  
tags: ["java", "array", "string"]  
reading_time: 1 minute  

---

# Make a string of JTextField variable

I make some [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) by

```
        String[] StoreValueFromTable = new String[5];        String[] ColumName = new String[5];        for(int Count=0;Count<5;Count++){            StoreValueFromTable[Count] = "MindStick"+Count;            ColumName[Count] = "MS"+Count;            System.out.println(StoreValueFromTable[Count]+", "+ColumName[Count]);        }
```

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to make JTextField[] Fiels[[Count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct)] = new JTextField(); it's [giving](https://yourviews.mindstick.com/view/80639/regifting-is-far-better-than-giving-away-a-bouquet) me error. I am not sure, is there a way to make it dynamically..

## Replies

### Reply by Anonymous User

Hi Mark,This works for me :\

```
final int TEXTFIELDS_COUNT = 5; // Create an array of 5 JTextFieldsJTextField[] fields = new JTextField[TEXTFIELDS_COUNT];for(int count = 0; count< TEXTFIELDS_COUNT; count++){    // fields[count] represents a single JTextField    fields[count] = new JTextField();    // Do something with fields[count], like setting its text     // fields[count].setText("some text");    StoreValueFromTable[count] = "QueryTechnica"+count;    ColumName[count] = "QT"+count;    System.out.println(StoreValueFromTable[count]+", "+ColumName[count]);}
```


---

Original Source: https://www.mindstick.com/forum/33793/make-a-string-of-jtextfield-variable

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
