• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

paint() method

 
Scott Roberts
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a bit confused about how the paint() method works.
In the MIDP2.0 spec Canvas, CustomItem and Layer have paint() however if I browse through 3rd party UI libraries I find many classes in them that use paint();
Is there any tutorial, book or website that explains paint()?


 
Peter Miklosko
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to explain more what you looking for.
For example you can get general info and examples on use of CustomItem from Beginning J2ME book, plus internet is full of other materials
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paint() is the method that gets called to render graphics objects into the GUI. Each visual component will have a paint() method implemented that draws whatever items are required to make itself visible. So a background component would draw the application background, the button components would each draw their associated buttons, and so on for the labels and text input controls, and so forth. Including any custom components you may have defined. Parent components ensure that their children get painted when the parent is repainted, which they may do explicitly, or in some cases, because the master paint method simply runs through all affected components in turn.

For performance reasons, paint requests are often placed on a queue and executed by an independent painting thread. The primary GUI thread usually caused these requests to be queued by calling some sort of invalidate() or repaint() method to indicate that an update (paint) is needed. In the case of complex desktops, moving other applications over the current application's display (or removing them from overlaying the current app) can also cause the app's GUI framework to queue up paint requests.
 
Scott Roberts
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim

That pretty much explains it! Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic