J2ME UI Flikker problem with Double Buffering implemented

  • Thread starter Farrukh K. Muhammad via JavaKB.com
  • Start date
F

Farrukh K. Muhammad via JavaKB.com

Hi,

I am Developing a Menu Based J2me Application using Canvas, where a Menu is
displayed on startup and upon selecting the menu relavent detail is
displayed.

The problem is that when switching between Canvases (Menu -> Details) the
application for a moment shows a white screen (flikker), which disturbs the
Layout. I thought this might be solved by implementing isDoubleBuffered()
technique, but it didn't help, the flikker was still present.

Then i went on and reduced the work load Details canvas constructor had to
do, and shifted it into a thread, but no luck.

Can any one please suggest any work around this problem.
 
D

Darryl Pierce

Farrukh said:
I am Developing a Menu Based J2me Application using Canvas, where a Menu is
displayed on startup and upon selecting the menu relavent detail is
displayed.

The problem is that when switching between Canvases (Menu -> Details) the
application for a moment shows a white screen (flikker), which disturbs the
Layout. I thought this might be solved by implementing isDoubleBuffered()
technique, but it didn't help, the flikker was still present.

What do you mean "implementing isDoubleBuffered()"? You don't override
this method; this method is the platform's way of telling *you* whether
double-buffering is supported. Overriding it is pointless since the
platform never calls that method...
Then i went on and reduced the work load Details canvas constructor had to
do, and shifted it into a thread, but no luck.

Can any one please suggest any work around this problem.

Can you post your code for switching from one screen to the other, please?
 
F

Farrukh K. Muhammad via JavaKB.com

basically

display.setCurrent(new Detail(previousCanvas, midlet, data));

... i have sort of over come that problem as i have implemented the
different screen to be in one.. and have boolean variables take care of
which content to paint on the same canvas over and over, this way I am able
to avoid the flicker problem.

But for the past few days having problems in creating a rolling text, as
the Ticker. Since the ticker is not support by Canvas (and even if it is we
cannot define where to display the ticker) I had to make a TimerTask
extended class that basically decreases the X point of the text drawn at a
Y position.

This works fine, but with time the Timer gains speed and at some point it
just gets out of control. Start up as it should and then gains speed.

the piece of code is as follows

Timer time = new Timer();
TimerTask timerTask = new Ticker(); //self constructed class prints a
string at a given X, Y location.
 
F

Farrukh K. Muhammad via JavaKB.com

basically

display.setCurrent(new Detail(previousCanvas, midlet, data));

... i have sort of over come that problem as i have implemented the
different screen to be in one.. and have boolean variables take care of
which content to paint on the same canvas over and over, this way I am able
to avoid the flicker problem.

But for the past few days having problems in creating a rolling text, as
the Ticker. Since the ticker is not support by Canvas (and even if it is we
cannot define where to display the ticker) I had to make a TimerTask
extended class that basically decreases the X point of the text drawn at a
Y position.

This works fine, but with time the Timer gains speed and at some point it
just gets out of control. Start up as it should and then gains speed.

the piece of code is as follows

Timer time = new Timer();
TimerTask timerTask = new Ticker(); //self constructed class prints a
//string at a given X, Y location.
time.schedule(timerTask, 2000, 60);

this starts up as it should but after having to go through a couple of
title tickers... the timer gains speed.. have no idea what is wrong with it.


please help..

Thanking in anticipation
 
D

Darryl Pierce

Farrukh said:
basically

display.setCurrent(new Detail(previousCanvas, midlet, data));

Can you give us a sample of the paint() method for Canvas being displayed?
... i have sort of over come that problem as i have implemented the
different screen to be in one.. and have boolean variables take care of
which content to paint on the same canvas over and over, this way I am able
to avoid the flicker problem.

But for the past few days having problems in creating a rolling text, as
the Ticker. Since the ticker is not support by Canvas (and even if it is we
cannot define where to display the ticker) I had to make a TimerTask
extended class that basically decreases the X point of the text drawn at a
Y position.

This works fine, but with time the Timer gains speed and at some point it
just gets out of control. Start up as it should and then gains speed.

Use a Thread instead of a TimerTask. I've never been happy with
TimerTasks on MIDs.
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top