Friday, 21 November 2008

Clear background Colour

I am finding difficulty doing research on finding a clear background colour for my j2me application that is using low level apis.

Currently, I am using these colours:

0xFFFFFF = white
0xBCEE68 = green
0x000000 = black

To set the background colour, use this method

To set the font colour, use this method

g in this case refers to Graphics and the bolded part is to specify the colour.
For more information about colours, go to this link:

In the example from this site:

// clear all with background color
g.fillRect( 0, 0, w, h );

// now use foreground color for drawing

"We discover the device's default background and foreground colors by calling the Display's getColor() method twice, passing it the appropriate constant each time, COLOR_BACKGROUND, then COLOR_FOREGROUND. Whether we elect to use the default colors or specify our own, OutlineItem.paint() fills a rectangle with the background color, then switches to the foreground color to draw the rest of the content."

No comments: