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

BlackBerry® World™ Development

Reply
Contributor
Posts: 16
Registered: ‎01-22-2013
My Device: Blackberry9800

paint method slow down typing speed

Hi,I am using CustomEditField in which i over ride paint method. Every thing is fine, but the problem which i am facing is that my typing in textfield slows down. I debug it many times and found that,it is because of paint method..Please any one give me suggestions for that..

 

 

-----------------------------------------------------------------xxxxxxxxxx------------------------------------------------------------------------

class CustomEditField extends EditField
{
private boolean _focusableFlag;
private String defaultText;

public CustomEditField(String defaultText)
{
super(FIELD_HCENTER);
this.defaultText = defaultText;


public void setFocusable(boolean focusable){
_focusableFlag =focusable;
}

protected void layout(int width, int height)
{
width = Font.getDefault().derive(Font.BOLD, Font.getDefault().getHeight()-2).getAdvance("Transfer to my Linked Account")+40;
height = Font.getDefault().getHeight();
super.layout(width,height);
super.setExtent(width,height);
super.setFilter(MyTextFilter.get(TextFilter.NUMERIC));
}
protected void paint(Graphics g)
{
setBorder(BorderFactory.createRoundedBorder(new XYEdges(5,5,5,5), 0xD0D0D0, Border.STYLE_SOLID));
setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));

if(super.getText().length() == 0)
{
g.setColor(0xD0D0D0);
g.drawText(defaultText, 0, 0);
g.clear();
}

g.setColor(0x484C54);
super.paint(g);

}



}

 

 

 

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: paint method slow down typing speed

This forum is for questions pertaining to app world. Please ask development question in the development forum for your environment.