Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 135
Registered: ‎08-27-2008
My Device: Not Specified

Transparency in Popupscreen.

[ Edited ]

Hello everybody,

 

I am developing an application in which I am using the popup screen which is created by extending the screen class.

 

In that I have overridden the paintBackground method as follows 

 

 protected void paintBackground( Graphics g ) {
        XYRect myExtent = getExtent();
        int color = g.getColor();
        int alpha = g.getGlobalAlpha();
        g.setGlobalAlpha(20);
        g.setColor(0x000000);
        g.fillRoundRect( 0, 0, myExtent.width, myExtent.height,30,30);
        g.setColor( color );
        g.setGlobalAlpha( alpha );
    } 

 

How to make this screen as semi Transparent or Transparent ?

 

with the above code snippet I am able to get some amout of Transparency but when I move the trackwheel ( i.e. focus moves from one component to another component ) then that transparent / semi - transparent screen becomes opaque.

 

Is something missing in my code

 

Thanks in advance

Message Edited by Amit_K on 09-15-2008 11:18 AM
Message Edited by Amit_K on 09-15-2008 11:19 AM
BlackBerry Development Advisor
Posts: 14,971
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Transparency in Popupscreen.

Please have a look at these posts.

 

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=4491&query.id=132...

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=3785&page=1

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 135
Registered: ‎08-27-2008
My Device: Not Specified

Re: Transparency in Popupscreen.

this paintBackground method is called everytime whenever I move the trackwheel ( i.e. focus moves from one component to another component ).

 

whenever the focus moves from one component to another component I want to redraw the entire popupscreen using the code given paintBackground method.

 

Is there any method to redraw the entire Popupscreen ?

 

Thanks in advance

Developer
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Transparency in Popupscreen.

Screen.invalidate()
Developer
Posts: 135
Registered: ‎08-27-2008
My Device: Not Specified

Re: Transparency in Popupscreen.

[ Edited ]
I have used the invalidate in paintBackground method but I am not able to get the semiTransparent Background.
what's the reason behind it ?
also one more thing. I have updated the above paintBackground method as follows 
protected void paintBackground(Graphics g) {
        if (paintingRequired) {
            try {
                XYRect myExtent = getExtent();
                int color = g.getColor();
                int alpha = g.getGlobalAlpha();
                g.setGlobalAlpha(0xCC);
                g.setColor(0x000000);
                g.fillRoundRect(0, 0, myExtent.width, myExtent.height, 30, 30);
                g.setColor(color);
                g.setGlobalAlpha(alpha);
            } catch (Exception e) {
                System.out.println(e.toString());
            }
            paintingRequired = false;
        }
    } 
I have kept the flag paintingRequired such that it allows the code to execute ( written in paintBackground method ) only once.
by this way I am able to get the semiTransparent background.
Is it Ok ? or there is any alternative instead of Blocking paintBackground method.
Thanks in advance.
Message Edited by Amit_K on 09-24-2008 02:13 AM