I am new to java Swing. I am trying to develop a tool, in which I used a Jtextpane as an editor. Jtextpane is enclosed in a Jtabbedpane to meet my requirement. But I have inserted the JTextpane in a Jscrollpane and then to the Jtabbedpane. Now, when I select a particular tab, I should get the corresponding Jtextpane. I have used the

jTabbedPane.getSelectedComponent();

But it returns the Jscrollpane. So, I am unable to save the contents in corresponding Jtextpane...

Can anybody plz help me to resolve this....

Thanks in Advance...

JTextPane will always be inside the JScrollPane, you need to check the JScrollPane and get/set text to the JTextPane.
If you can post some code will be more easier to provide help

If each Tab has a JTextPane make an array of them
then textPane[tabbedPane.getSelectedIndex()] will be the one in use

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.