D
Douglas Dillon
I'm trying to scroll an image by shifting it with a timer. I figured I
could shift 1000 pixels per second (limit of the timer) but it's not
behaving the way I expected. From what I can tell it's taking 18
seconds to process 1000 pixels. The code is below:
public void init()
{
listener = new TimeSegment(this);
t = new Timer(i_CountDownCurValue, listener);
t.start();
}
class TimeSegment implements ActionListener
{
private BaseClass m_s;
public TimeSegment(BaseClass s)
{
m_s = s;
}
public void init()
{
}
public void actionPerformed(ActionEvent event)
{
m_s.TestFunction();
}
}
public void TestFunction()
{
i_Yoffset += 1;
repaint();
}
The offset is applied to the image in the update(). I'm sure I'm
missing something very simple.
Also, what can I use to have results faster than milliseconds?
Thanks,
Douglas
could shift 1000 pixels per second (limit of the timer) but it's not
behaving the way I expected. From what I can tell it's taking 18
seconds to process 1000 pixels. The code is below:
public void init()
{
listener = new TimeSegment(this);
t = new Timer(i_CountDownCurValue, listener);
t.start();
}
class TimeSegment implements ActionListener
{
private BaseClass m_s;
public TimeSegment(BaseClass s)
{
m_s = s;
}
public void init()
{
}
public void actionPerformed(ActionEvent event)
{
m_s.TestFunction();
}
}
public void TestFunction()
{
i_Yoffset += 1;
repaint();
}
The offset is applied to the image in the update(). I'm sure I'm
missing something very simple.
Also, what can I use to have results faster than milliseconds?
Thanks,
Douglas