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
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Border to the BitmapField Using Graphics.drawRoundRect

Hi All,

I am using the drawRoundRect method to draw the border to the BitmapField.

But the problem i am facing is the "thickness of the border is too thin i.e. almost invisible to the user.

 

So, how to increase the line thickness to draw a border using drawRoundRect method in the paint.

 

Or any other solution.......??

 

Regards,

Abhay

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

Draw one more  roundrect with one pixel differece to looklike a thick border.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

[ Edited ]

bitmapField_CancelButton = new BitmapField(bitmapButton,BitmapField.FOCUSABLE){

               protected void layout(int maxWidth,int maxHeight){

                      super.layout(maxWidth,maxHeight); setExtent(bitmapButton.getWidth(),bitmapButton.getHeight()); }

               public void paint(Graphics graphics) {

                    super.paint(graphics); graphics.setColor(Color.WHITE);

                    graphics.setFont(this.getFont().derive (Font.BOLD,DvrConstants.BUTTON_TEXT_FONT_SIZE));

         graphics.drawText("Cancel", ((bitmapButton.getWidth() - this.getFont().getAdvance("Cancel"))/2)+5,bitmapButton.getHeight()/2-9); 

          if(isFocus()) {

                   graphics.setColor(DvrConstants.BORDER_COLOR);

                   graphics.drawRoundRect(0,0,this.getWidth(),getHeight(),10,10);

                   graphics.drawRoundRect(0,0,this.getWidth()+1,getHeight()+1,10,10);

                           }

                }

             }

 

This is what have done as you said. Two roundRect methods......but still the same result. How to get left side co-ordinates (0 - ?)

 

Thanks,

Abhay

Message Edited by abhaymulye on 10-05-2009 09:20 AM
Please use plain text.
New Developer
neeraj
Posts: 20
Registered: ‎07-23-2008
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

there is lot of  ways to do this,,,you may use fillRounrect method to make this happen and manually draw bitmap through graphics.drawbitmap method after fillRoundRect. width and height of rounded rect would be little more then with and height of bitmap so that it would see like border arround bitmapfield.

 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

Your x and y positions still the same, you can vary that too so you get a clear view of other reoundrect sitting just next to the other roundrect.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

Hi,

Thanks for help.......but

 

My requirement is to draw a border when the Field has focus & viceVersa.

 

So, how to handle the Focus & unFocus methods & to draw a border in paint method??

 

 

Regards,

Abhay

 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

You could give a look at the Field class methods, it has methods to inform you about when field has focus and lost focus. You could make use of booleans and use that in paint method.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

Hi,

Ok. I have to include Focus(int direction) & unFocus() methods in my Field object.....right. But my paint method not getting invoked.

 

I have used invalidate() in these methods, to call paint(). Is it correct way????

 

 

Or could you please give me some code snippest!!

 

Thanks

Abhay

Please use plain text.
New Developer
neeraj
Posts: 20
Registered: ‎07-23-2008
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

[ Edited ]

then you didn't mention in ur query initially that you want border on focus.

you can override drawfocus,onFocus and onUnfocus method to do this.

 

this thread may help:

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

Message Edited by neeraj on 10-06-2009 02:45 AM
Please use plain text.
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Border to the BitmapField Using Graphics.drawRoundRect

Hi,

I am able to draw the border using drawRoundRect() , When focus is on or off.

 

But the problem Remains the same i.e. BORDER THICKNESS!!

 

How to increase the thickness of line?? Any Suggestions.

 

Also want know about stipple??? I came across it when seaching for my issue.

 

Regards,

Abhay

Please use plain text.