Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 如何更改黑莓应用程序中的荧光灯(蓝色)?_Blackberry_Java Me_Highlighting_Onfocus - Fatal编程技术网

Blackberry 如何更改黑莓应用程序中的荧光灯(蓝色)?

Blackberry 如何更改黑莓应用程序中的荧光灯(蓝色)?,blackberry,java-me,highlighting,onfocus,Blackberry,Java Me,Highlighting,Onfocus,blackberry中的默认突出显示颜色为蓝色。我目前正在做一个主色调是红色的应用程序。有没有办法把荧光灯的颜色改成红色?我在谷歌上搜索了它,找到了列表字段的解决方案,其他字段如按钮、文本字段、位图字段等如何?您可以覆盖自定义字段: protected void drawFocus(Graphics g, boolean on) { // Custom focus painting } 您可以覆盖自定义字段: protected void drawFocus(Graphics g, b

blackberry中的默认突出显示颜色为蓝色。我目前正在做一个主色调是红色的应用程序。有没有办法把荧光灯的颜色改成红色?我在谷歌上搜索了它,找到了列表字段的解决方案,其他字段如按钮、文本字段、位图字段等如何?

您可以覆盖自定义字段:

protected void drawFocus(Graphics g, boolean on) {
    // Custom focus painting
}
您可以覆盖自定义字段:

protected void drawFocus(Graphics g, boolean on) {
    // Custom focus painting
}

在blackberry论坛上找到了这个实现,并进行了尝试,效果非常好。但是,您需要为每个字段重写此方法,以便使用不同的高亮显示

protected void drawFocus( Graphics g, boolean on ) {    
    XYRect focusRect = new XYRect();                
    getFocusRect( focusRect );                
    int yOffset = 0;                

    if ( isSelecting() )     
    {        
        yOffset = focusRect.height >> 1;        
        focusRect.height = yOffset;        
        focusRect.y += yOffset;    
    }                
    g.pushRegion( focusRect.x, focusRect.y, 
                  focusRect.width, focusRect.height, 
                  -focusRect.x, -focusRect.y );   
    g.setBackgroundColor(/*your color here*/);    
    g.setColor( 0xFFFFFF );    
    g.clear();                
    this.paint( g );                
    g.popContext();
}

在blackberry论坛上找到了这个实现,并进行了尝试,效果非常好。但是,您需要为每个字段重写此方法,以便使用不同的高亮显示

protected void drawFocus( Graphics g, boolean on ) {    
    XYRect focusRect = new XYRect();                
    getFocusRect( focusRect );                
    int yOffset = 0;                

    if ( isSelecting() )     
    {        
        yOffset = focusRect.height >> 1;        
        focusRect.height = yOffset;        
        focusRect.y += yOffset;    
    }                
    g.pushRegion( focusRect.x, focusRect.y, 
                  focusRect.width, focusRect.height, 
                  -focusRect.x, -focusRect.y );   
    g.setBackgroundColor(/*your color here*/);    
    g.setColor( 0xFFFFFF );    
    g.clear();                
    this.paint( g );                
    g.popContext();
}