How to do animation with JTextArea?

J

juliekcf

Animation is usually done using images. If what I want to move is
actually a JTextArea, how can I move it? There are no initial x- and
y-coordinates for the JTextArea. In my case, there are more than 10
JTextArea in the screen displayed using BoxLayout.

Can anyone help me, please?

Thanks in advance.

Julie
 
V

VisionSet

Animation is usually done using images. If what I want to move is
actually a JTextArea, how can I move it? There are no initial x- and
y-coordinates for the JTextArea. In my case, there are more than 10
JTextArea in the screen displayed using BoxLayout.

Can anyone help me, please?

You can not do this if you keep the layout manager, it would be fighting it.
If you must set a null layout - Container.setLayout(null); then you have x &
y positioning through Component.setLocation().
Sounds like a bad idea to me though.
 
A

Andrew Thompson

VisionSet said:
You can not do this if you keep the layout manager, it would be fighting
it.

Not necessarily, depends on the layout manager.
If you must set a null layout - Container.setLayout(null); then you have x &
y positioning through Component.setLocation().
Sounds like a bad idea to me though.

It is. Even for this situation, it is best to create
a custom layout that suits your needs.

I developed a 'ScrollLayout' for my PhySci
project*. The layout can be seen in action
if you install my PhySci app and open one
of the six progs.
The messages scroll across the top.

You can download the jar itself (contains full source)
at http://www.physci.org/PhySci.jar

* Important note - this was _after_ I had tried
exactly what you suggested, setting the layout
to null and using setLocation (..so I am guilty myself)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top