Forums Register Login

Trouble with paint

+Pie Number of slices to send: Send
Hi,

I am having the following problem.

From class1(which extends Canvas) depending on the key pressed,
I change the display and try to change the font colour(in the new display).

The problem is that when the repaint has no effect and only when I exit keyPressed function I see the final colour change for image created by paint for class2

public void keyPressed(int keyCode)
{
if(keyCode == Canvas.KEY_POUND)
{
Display.getDisplay(this).setCurrent(class2_obj);//class2 extends canvas
repaint();//Should call class2 paint()
.....
.....
repaint();//Should call class2 paint()
}
}
+Pie Number of slices to send: Send
 

//Should call class2 paint()


Huh? Any unqualified method invokation refers to the intance of the class in which the code resides i.e. repaint() is equivalent to this.repaint(). Not to [some other object].repaint().
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 939 times.
Similar Threads
Detect "dial" button pressed from J2ME program
Problem while trapping the navigation keys
Problem with KeyListener
anyone used Canvas + graphics ?
Canvas not displaying
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:42:43.