aspose file tools*
The moose likes Java Micro Edition and the fly likes How to 'dim' the canvas? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to Watch "How to New topic
Author

How to 'dim' the canvas?

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
My midlet uses a canvas where ocassionally a little popup info box may appear in the centre of the canvas.

When it appears, I would like to make the surrounding area go darker.

Does anyone know how I could achieve this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

The usual approach is to create a translucent window the same size as the screen, overlaying the screen and painted with a gray pattern (alternating black and clear pixels, for example.

Then the actual dialog would be overlaid on to of the translucent window.


Customer surveys are for companies who didn't pay proper attention to begin with.
James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
So the end of my paint method is changing from:



to



...it seems to work ok. Is that the way you meant?

Also, rather than create one large image, is it less memory-intensive to create a smaller image and paint is several times to the canvas?

Cheers,
James

[ November 08, 2007: Message edited by: James Hodgkiss ]
[ November 08, 2007: Message edited by: James Hodgkiss ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to 'dim' the canvas?