Scrolling an image

  • Thread starter testing1234567891011
  • Start date
T

testing1234567891011

I'm making a Swing application with Java 5.0 that is constantly
updating pixel-sized custom components on a JPanel from the top of the
panel downwards. When the updates get to the bottom, I would like to be
able to scroll the image that has been created by the updates upwards
and continue to update it at the bottom. How can I create a snapshot of
a section of a JPanel, and repaint it at another location (x, y+1) so
as to scroll the image?

Thanks in advance,
Rob
 
A

Andrew Thompson

I'm making a Swing

c.l.j.gui is that'a'way..
..application with Java 5.0 that is constantly
updating pixel-sized custom components on a JPanel from the top of the
panel downwards.

Updating? How? By adding them to an existing layout?

Perhaps you should consifer letting the code do the talking..
..When the updates get to the bottom, I would like to be
able to scroll the image that has been created by the updates upwards
and continue to update it at the bottom.

JScrollPane()?
 
J

jan V

I'm making a Swing application with Java 5.0 that is constantly
updating pixel-sized custom components on a JPanel

Can you disclose what precisely these pixel-sized components do? It sounds
like a very heavy weight approach to use Swing components for entities that
are that small on screen.. In your subject line you chose the word "image"
to describe the overall effect of these components, so why do you need
components for every image pixel?
 
K

Krashan

I get what the man is trying to achieve: I guess it is scrolling paper
tape effect.

So he wants to paint something line-by-line top-down, and after
reaching bottom line he wants to scroll the whole window up by a line
to make a place for new one.
From this point on I'm too weak in Swing to help any further.

Best regards,
Pawel Kraszewski
 
T

testing1234567891011

Krashan said:
I get what the man is trying to achieve: I guess it is scrolling paper
tape effect.

So he wants to paint something line-by-line top-down, and after
reaching bottom line he wants to scroll the whole window up by a line
to make a place for new one.

Exactly.
 
K

Knute Johnson


Draw onto a BufferedImage. When you have drawn to the bottom, get the
pixel data and move it up one line. Draw on the last pixel line.
Repeat until tender.
 
J

Joan

I'm making a Swing application with Java 5.0 that is constantly
updating pixel-sized custom components on a JPanel from the top
of the
panel downwards. When the updates get to the bottom, I would
like to be
able to scroll the image that has been created by the updates
upwards
and continue to update it at the bottom. How can I create a
snapshot of
a section of a JPanel, and repaint it at another location (x,
y+1) so
as to scroll the image?

Thanks in advance,
Rob

Did you try scrolPane ?
I think it does that for you automatically.

JScrollPane scrollPane = new JScrollPane(table);
 

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

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,226
Latest member
KristanTal

Latest Threads

Top