0

like

JTextArea ta[1]= new JTextArea();

bcoz I have many tabs in text editor and I want perform cut copy paste option. and if I use a same name for all tabs then all option work only last tab because that textarea initialized in end.

Timothy
  • 2,004
  • 3
  • 23
  • 29
  • 2
    Welcome to StackOverflow :) Please take the time to read the advice provided here on [how to ask](http://stackoverflow.com/help/how-to-ask) and edit your question accordingly – Peter Jun 19 '16 at 14:30
  • 2
    Words typed in all lower case are hard to read, like trying to listen to someone who is mumbling. Please use an upper case letter at the start of sentences, for the word I, and proper names like `ArrayList` or Oracle. As an aside, that word is spelled 'because' rather than 'bcoz' - it doesn't make you look cool to use 'hacker speak' (or whatever you want to think of it as) it just makes you look a fool. – Andrew Thompson Jun 19 '16 at 14:59
  • 1
    Give each tab it's _own_ text component, as shown [here](http://stackoverflow.com/a/11007109/230513) for `JTextField` – trashgod Jun 19 '16 at 16:59

1 Answers1

0

If you need an array of JTextArea objects, you can declare it like this:

JTextArea[] textAreas = new JTextArea[count];

where count is the number of objects you need

Then you can access it as normal:

textAreas[i]

where i is the index you need to access.

Ahmed Amr
  • 579
  • 3
  • 10