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
Highlighted
Developer
Posts: 84
Registered: ‎01-10-2013
My Device: Bold 9900
My Carrier: China Unicom
Accepted Solution

Issue about rom of 9900, override paint() method failed

Before I'm updating the ROM (9900jAllLang_PBr7.1.0_rel2435_PL5.1.0.622_A7.1.0.862_AT_T.exe) for my 9900, I can easily overrides the paint() method to change sytles of label or text field, e.g. font size, text color and so on.

 

But, after updating, I can still control text color, except font size!

 

I can make sure that my codes worked correctly in "before", I think this must be a system problem because all of my apps cannot resize font size any more!

 

Is there aother way to solve this problem? I need your help, thanks!~

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

Re: Issue about rom of 9900, override paint() method failed

that would be a very strange issue which i would doublecheck, i seriously doubt that an OS upgrade could somehow influence how the paint method works.
----------------------------------------------------------
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
Developer
Posts: 84
Registered: ‎01-10-2013
My Device: Bold 9900
My Carrier: China Unicom

Re: Issue about rom of 9900, override paint() method failed

thanks simon, btw, my last ROM is 9900jAllLang_PBr7.1.0_rel2283_PL5.1.0.593_A7.1.0.825_Vodafone_DE.exe
Developer
Posts: 16,987
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Issue about rom of 9900, override paint() method failed

if you are really convinced that this is the issue you can downgrade your device to that version.
----------------------------------------------------------
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
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Issue about rom of 9900, override paint() method failed

"Before I'm updating the ROM (9900jAllLang_PBr7.1.0_rel2435_PL5.1.0.622_A7.1.0.862_AT_T.exe) for my 9900, I can easily overrides the paint() method to change sytles of label or text field, e.g. font size, text color and so on."

 

My initial thought from this description is that in fact you are, from within paint(), changing the style, font or content of the Field which you are painting.  You should not do it.  paint() is just for painting, you should be changing the data or the Field you are painting. 

 

So possibly the problem you are having is that the older OS let you do something that it really shouldn't have done, and now the newer one is, correctly, not letting you do it. 

 

Can you show us the font instructions that used to work and now don't?

Developer
Posts: 84
Registered: ‎01-10-2013
My Device: Bold 9900
My Carrier: China Unicom

Re: Issue about rom of 9900, override paint() method failed

//code for demo changing font size

LabelField about=new LabelField("About & Help", USE_ALL_WIDTH | LabelField.ELLIPSIS) {
    public void paint(Graphics g)
    {
    	g.setFont(Font.getDefault().derive(Font.BOLD, Font.getDefault().getHeight(Ui.UNITS_pt)+2,Ui.UNITS_pt));
    	super.paint(g);	
    }
};

 Below is the screenshot of the running result in simulator (BlackBerry 9800 Asia, Software Version 6.0.0.706, Platform Version 3.0.0.159)

 

9800.png

 

And then is the screenshot of my device (BlackBerry Bold 9900, Software Version 7.1.0.862, Platform Version 5.1.0.622)

 

ScreenShot_2013-03-26_09-07-41.png

 

 

Both of these running result were using the same code.

Developer
Posts: 84
Registered: ‎01-10-2013
My Device: Bold 9900
My Carrier: China Unicom

Re: Issue about rom of 9900, override paint() method failed

Apps not only service for its owner, and I cannot send an order to users to downgrade their device, just for display any different size characters, I have no idea.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Issue about rom of 9900, override paint() method failed

Code looks OK, but I would like you to try something.  Can you please set the font for the LabelField rather than changing the Font duing paint.  So change this:

 

LabelField about=new LabelField("About & Help", USE_ALL_WIDTH | LabelField.ELLIPSIS) {
    public void paint(Graphics g)
    {
    g.setFont(Font.getDefault().derive(Font.BOLD, Font.getDefault().getHeight(Ui.UNITS_pt)+2,Ui.UNITS_pt));
    super.paint(g);
    }
};

 

to something like this:

 

LabelField about=new LabelField("About & Help", USE_ALL_WIDTH | LabelField.ELLIPSIS);

about.setFont(Font.getDefault().derive(Font.BOLD, Font.getDefault().getHeight(Ui.UNITS_pt)+2,Ui.UNITS_pt);

Developer
Posts: 84
Registered: ‎01-10-2013
My Device: Bold 9900
My Carrier: China Unicom

Re: Issue about rom of 9900, override paint() method failed

Thanks peter, I will try this later, but my simulator damaged, I cannot running app on it now, always show "debugger attach failed", damaged....
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Issue about rom of 9900, override paint() method failed

Happens to me from time to time.  Clean it and restart everything.  That usually works for me.  But recently I had to back out some system maintenance (thank <insert deity of choice> for System Restore) and then it started working again.  Re installed the maintenance and still worked, don't know what to make of that.

 

Anyway good luck on both problems.