I want to make a program same as notepad with tab option. I created a tab with JTabbedPane and add TextArea in that. tab created whit user when program run. how I can access to JTextArea in selected tab by user to save data and other options?
JPanel
. This class will container a JTextArea
(presumably within a JScrollPane
) When you need to add another tab, create an instance of this class, configure as you need. Generate a unique identifier for it (probably the same as the tab's name) and add it to a Map
of some kind, keyed to the identifier.
When you need to, using the identifier, get the instance of "editor pane".
Some other useful methods you might need
尝试像这样访问它:
JTextArea TextArea1= (JTextArea)jTabbedPane1.getSelectedComponent();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.