Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to reach current JTextArea

 
ankit maini
Greenhorn
Posts: 25
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
I have one tabbed Pane and 4 tabs say tab1,tab2,tab3 and tab4.
In these tabs scroll pane is there and each scroll pane has text areas. Now i want to get the text from current text area how to reach at current selected JTextArea ?
 
Martin Vajsar
Sheriff
Pie
Posts: 3751
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JTabbedPane class has methods to determine the currently selected pane (getSelectedComponent and getSelectedIndex). Several solutions are possible, eg. a JTextArea[] array with components corresponding to the individual panels (you'll initialize this array when constructing your frame), then using getSelectedIndex() method as an index into this array to get the current component.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic