This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes how to reach current JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "how to reach current JTextArea" Watch "how to reach current JTextArea" New topic
Author

how to reach current JTextArea

ankit maini
Greenhorn

Joined: Feb 08, 2011
Posts: 25

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
Bartender

Joined: Aug 22, 2010
Posts: 2318
    
    2

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to reach current JTextArea
 
Similar Threads
JScrollBar/JScrollPane
Using JScrollPane
Which JScrollPane ?
JTextArea problem
Reading a file in ScrollPane