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
Accepted Solution

Creating Borderless Popup screen

Hello everybody,

 

I am developing an application in which I am using the popup screen.

 

but the popup screen comes with default white border.

 

How to remove the default white border of Popup screen.

 

if possible can anybody explain me with code snippet ?

 

Thanks in advance

Highlighted
New Developer
Posts: 20
Registered: ‎07-18-2008
My Device: Not Specified

Re: Creating Borderless Popup screen

The below code was copied from BlackberryForums.com. I could not remember the original link and give all the credit to the original author.

 

class CustomPopupScreen extends Screen { private final static int _CUSTOM_SIZE = 100; private final static int _ALPHA = 0xBF; // 75% alpha private final static int _X = ( Display.getWidth() - _CUSTOM_SIZE ) >> 1; private final static int _Y = ( Display.getHeight() - _CUSTOM_SIZE ) >> 1; CustomPopupScreen() { super( new VerticalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR ) ); add( new LabelField( "hello, world" ) ); } protected void sublayout( int width, int height ) { setExtent( _CUSTOM_SIZE, _CUSTOM_SIZE ); setPosition( _X, _Y ); layoutDelegate( _CUSTOM_SIZE, _CUSTOM_SIZE ); } protected void paintBackground( Graphics g ) { XYRect myExtent = getExtent(); int color = g.getColor(); int alpha = g.getGlobalAlpha(); g.setGlobalAlpha( _ALPHA ); g.setColor( 0xE3E3E3 ); g.fillRect( 0, 0, myExtent.width, myExtent.height ); g.setColor( color ); g.setGlobalAlpha( alpha ); } protected boolean keyDown( int keycode, int status ) { if ( Keypad.key( keycode ) == Keypad.KEY_ESCAPE ) { close(); return true; } return super.keyDown( keycode, status ); } }

 

 

 

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

Re: Creating Borderless Popup screen

Thank you very much for the Link

 

But in this example the CUSTOM_SIZE is fixed i.e. 100. Therefore, Height and width are fixed.

 

Is there any way such that it will work similar to the popupscreen

 

( i.e if the Popup screen has only one Componant then it will reduce its size and if it has 10 componants then it will expands to fit its size )

 

Thanks in advance

Developer
Posts: 222
Registered: ‎11-11-2009
My Device: Storm

Re: Creating Borderless Popup screen

Hi Amit,

   I think this thread will be useful for you

http://supportforums.blackberry.com/t5/Java-Development/PopupScreen-with-transparent-background-and-...

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Developer
Posts: 193
Registered: ‎04-27-2009
My Device: Not Specified

Re: Creating Borderless Popup screen

 

 

you can override following method:-

protected void applyTheme(){}

 

Contributor
Posts: 41
Registered: ‎07-19-2011
My Device: 9500
My Carrier: airtel

Re: Creating Borderless Popup screen

Hi All,

 

I need to get the height & width of transparent part in an image. Is it possible. Please let me know how it is possible if possible. I am using midlet.