Scrolling the Graphics of a Component

M

Martin Eichenseher

Hi all,

i hava a big problem. I would like to implement a algorithm to generate a
sinus function.

the y-value should be displayed on a specific x-point like 1, y with e.g.
drawOval() on the
graphics ( or Graphics2D )

But my problem is, after printing the point, the complete graphics context
should scoll
one step to the right, to display the next value.

Could someone give me a hint, how to manage this?
 
J

John C. Bollinger

Martin said:
Hi all,

i hava a big problem. I would like to implement a algorithm to generate a
sinus function.

the y-value should be displayed on a specific x-point like 1, y with e.g.
drawOval() on the
graphics ( or Graphics2D )

But my problem is, after printing the point, the complete graphics context
should scoll
one step to the right, to display the next value.

Could someone give me a hint, how to manage this?

Look somewhere else. That is to say, it doesn't make much sense to talk
about "scrolling" a graphics context. Scrolling is something that a GUI
component may do to a view (which may offer a graphics context with
which the program may draw on it). If scrolling is in fact what you
really want then you cannot accomplish it through the Graphics: look at
options through the Component that presents the view.

If you are talking about managing the drawing code itself in this
(somewhat strange) way, then you may find that Graphics.translate() is a
useful method. Do note, however, that your translation will probably
not be sticky -- that is, you cannot in general expect the next Graphics
that the method is passed to display the effects of a translation
applied during a previous invocation.


John Bollinger
(e-mail address removed)
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top