i can set the location of a "textArea" to ex : 100,100 using setLocation(100,100).
But when i change the size of the frame the position is changed also.
Is there a way of fixing the position or must the position be set in "paintComponent" ?
The location must *never* be set in any painting method override. Painting methods are for painting and only painting, don't ever alter the state of the component there.
Learn to use layout managers.
Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
When you add any componets in Frame, it's layout is managed by certain layouts.
So when size of frame changes, it affects all components - size, positions etc.
Using layout is very good. Notice when you resize any window frame, how all it's components try to manage in best possible manner. That's cool isn't it.
But if you really want static postition, don't use layouts, set it to null for frame.
thanks for the reply.
What do you mean by setting it to null for frame ?
Setting the Layout to null