Scrollable textarea (the conversion rules did not help)

I am currently converting a programm from awt to swing.
I have a list of TextComponents and use it to add them to containers and to change the text.
Using the standard conversion of awt textfields (Jtextfield on jscrollpane) leads to a problem here since i can only either add the scrollpane or the textarea tot he List without making large changes.
If i add the scrollpane i run into problems if i want to access it as textcomponents if i add the textarea i don't know how to inform the programm to add the scrollpane when dynamically adding.
Any ideas?
I was thinking along the following lines but did not reach a result:
Is there an interface that i can implement in an extension of jscrollpane or jtextcomponent that allows me to use 1 Component as both?
Is there an i get added to a container method that i can overriede? (If textcomponent gets added inform container that textcomponent on scrollpane is added instead)

The problem is that i have an abstract class that defines the basic properties of my Frame and gives methods to add and manipulate textcomponents. If i just put a scrollpane between my textcomponent and the frame this system breaks down as i have to add 1 scrollpane which is not a text component and a textcomponent oon top of it. If i do that by foot thats no problem but it gets difficult when doing it dynamically.
I solved it by extending JPanel and for ordinary Textcomponents just add it tot he pannel and pipeline getText and setText through the panel. It just is a waste of memmory to have a panel only to hold a Textcomponent.

Similar Messages

Maybe you are looking for