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
Contributor
Posts: 41
Registered: ‎04-24-2012
My Device: storm
My Carrier: blackberry

Problem with setStrokeWidth

I have a problem with the setStrokeWidth() method in the graphics library. When I run the code below the setStrokeWidth only works on the drawRec and the drawEilipse but not on the drawRoundedRec why is it like that am I doing it wrong? Thanks for the comments and suggestions

 

package mypackage;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Graphics;

public class MyField extends Field{
    private int ttwidth;
    private int hhheight;
    
    public MyField() {
        
    }
    
    protected void layout(int width, int height) {
        ttwidth = Display.getWidth();
        hhheight = Display.getHeight();
        setExtent(ttwidth, hhheight);
    }
    
    protected void paint(Graphics g) {
       g.setStrokeWidth(20);
        g.drawRect(15, 15, 80, 80);
     
        g.setStrokeWidth(20);
        g.setColor(0x6699FF);
        g.drawRoundRect(125, 15, 80, 80, 25, 25);
        
        g.setStrokeWidth(20);
        g.setColor(0xCCCCCC);
        g.drawEllipse(105, 205, 165, 245, 105, 275, 0, 360);
    }
}


Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem with setStrokeWidth

Contributor
Posts: 41
Registered: ‎04-24-2012
My Device: storm
My Carrier: blackberry

Re: Problem with setStrokeWidth

but the set stroke width method works but only in a few situations

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem with setStrokeWidth

Interesting, I did not think it worked anywhere!

 

I guess the fact that it is not documented in the API suggests that RIM know it doesn't work everywhere and so have not documented it, until they have fixed it presumably.  But that is just a guess. 

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problem with setStrokeWidth


peter_strange wrote:

until they have fixed it presumably.  But that is just a guess. 


read: never 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter