Class derived from LabelField with custom font color, but when focus not only

Hello

I have some problems with the LabelField-derived class. I want it has customized color background and police, but only when it does not have focus.

I tried to do the following:

protected void paint(Graphics g) {
    if (isFocus()) {
        super.paint(g);
    }
    else {
        final int bgColor = g.getBackgroundColor();
        final int fgColor = g.getColor();

        g.setBackgroundColor(backgroundColor);  // from member
        g.setColor(fontColor);  // from member

        super.paint(g);

        g.setColor(fgColor);
        g.setBackgroundColor(bgColor);
    }
}

but the final effect is that this field has the custom until the first focus/unfocus font color. When I do not check the isFocus(), police have custom color when the field has focus too.

Similar do in drawFocus (Graphics g, boolean on) does not solve the problem either.

I target BB > = 4.6.0.

Do you know how to do properly without calls drawText custom?

Kind regards

Piotr

What happens if you replace

If (isFocus())

with

If (g.isDrawingStyleSet (Graphics.DRAWSTYLE_FOCUS))

and (maybe - I'm totally guessing here) substitute drawFocus doing nothing?

BlackBerry GUI has many peculiarities, so you never know what path is right.

A word of caution: most likely, you will have also to invalidate() field when it changes its "focused" State Don't do this in onFocus() / onUnfocus()! Those (especially the onUnfocus()) are not always correctly called (BB frame problem). Make your field implement FocusChangeListener and make these invalidations in the method focusChanged() (using setFocusListener (this) somewhere in the constructor).

Tags: BlackBerry Developers

Similar Questions

  • Click on the color button and write in textarea with this font color

    Hello world

    I want to do the following:

    • Click on a "red" button
    • write in the text box with a red font
    • Click the 'blue '.
    • write in the text with a font color blue box

    Does not use this possible in flash 10 AS3?

    I tried to use setTextFormat but the problem is that I have the text before inserting on this format.

    Please someone tell me how to do?

    Thank you very much in advance

    Concerning

    :

    Import fl.controls.Button;
    Import fl.controls.TextArea;
    import flash.text.TextField;
    import flash.events.MouseEvent;

    var tf2:TextField = createTextField (100,100,200,22,true);

    TF2.Type = "input";
    TF2. Background = true;
    TF2. BackgroundColor = 0 x 777777;
    TF2. Width = 400;
    TF2. Height = 200;
    TF2.x = 100;
    TF2.y = 100;

    var df1:TextFormat = new TextFormat();
    DF1. Bold = false;
    DF1. Align = "center";
    DF1. Color = 0xffffff;
    DF1. Size = 14;
    TF2.defaultTextFormat = df1;
    TF2. Text = "[text]";
    TF2.setTextFormat (df1, 0);

    addChild (ta2);
    TA2. Move (150,100);

    TF2.addEventListener (Event.change, f);

    function f(e:Event):void {}
    TF2.setTextFormat(DF1,TF2.caretIndex-1);
    }

    var btn_Colour_Red:Button = new Button();
    btn_Colour_Red.label = "Red";
    btn_Colour_Red.addEventListener (MouseEvent.CLICK, btn_Colour_Red_Clicked);
    btn_Colour_Red.setSize (40: 20);
    btn_Colour_Red.move (350, 0);
    addChild (btn_Colour_Red);

    var btn_Colour_Blue:Button = new Button();
    btn_Colour_Blue.label = "Blue";
    btn_Colour_Blue.addEventListener (MouseEvent.CLICK, btn_Colour_Blue_Clicked);
    btn_Colour_Blue.setSize (40: 20);
    btn_Colour_Blue.move (250, 0);
    addChild (btn_Colour_Blue);

    function btn_Colour_Red_Clicked(e:MouseEvent) {}
       
    DF1. Bold = false;
    DF1. Align = "center";
    DF1. Color = 0xFF0000;
    DF1. Size = 14;
    TA2. SetFocus();
    internship. Focus = tf2;
    }

    function btn_Colour_Blue_Clicked(e:MouseEvent) {}
       
    DF1. Bold = false;
    DF1. Align = "center";
    DF1. Color = 0x0000FF;
    DF1. Size = 14;
    TA2. SetFocus();
    internship. Focus = tf2
    }

    function createTextField(x:Number,_y:Number,_width:Number,_height:Number,_border:Boolean):TextField {}
    var result: TextField = new TextField();
    result.x = x;
    result.y = y;
    result. Width = width;
    result. Height = height;
    result. Background = true;
    result. Border = border;
    addChild (result);
    return the result;
    }

  • I bought a laptop computer with non-genuine windows 7 I have the windows xp product key pro, etc. from the bottom of the laptop, but I do not have the windows xp pro cd.

    I bought a laptop computer with non-genuine windows 7. I have the original windows xp product key pro, etc. from the bottom of the laptop, but I do not have the windows xp pro cd.  Help me, please!

    You will need to either buy a version authentic retail Windows XP, with its key sales, to a true scource or visit the site of laptop manufacturers, support for your model and see what versions of win are taken care of, then buy a commercial version of this o/s.

    The key on the base of the laptop is the recovery key that requires that the recovery disks provided by the manufacturer.

    You could phone manufacturers to support to see if they have the origonal recovery cd send you, for which it maybe a small fee.

  • Hi, I bought acrobat adobe pro ms with order number: 12287735659 but I have not received the download link and the serial numbers of adobe and had this message there is a problem processing your order, please contact our Service team at the 800 448 custom

    Hi, I bought acrobat adobe pro ms with order number: 12287735659 but I have not received the download link and the serial numbers of adobe and had this message there is a problem processing your order, please contact our Service team customer to 800 448 1642 for assistance. my credit card is already loaded, but not received numbers.please series suggest

    Hi Kunal,

    If the problem still persists, can you please contact the support for this issue through https://helpx.adobe.com/support.html#/top_products.

    Please do not hesitate to me message in person if assistance is needed.

    Concerning

    Stéphane

  • DURING THE INSTALLATION OF LIGHTROOM DVD 6;  SHOWN IN LIGHTROOM UNDER OPTIONS WITH A WARNING COLOR YELLOW INDICATING VISTA NOT SUPPORTED.  7 RUNNING

    DURING THE INSTALLATION OF LIGHTROOM DVD 6;  SHOWN IN LIGHTROOM UNDER OPTIONS WITH A WARNING COLOR YELLOW INDICATING VISTA NOT SUPPORTED.

    I'M RUNNING 7 WITH 4 GB OF RAM AND 30 GB OF FREE SPACE

    TOTAL INSTALL 0.0 KB

    GABRIEL

    Please see:

    System requirements for Adobe Lightroom for Mac OS and Windows

    You can try to run the application in compatibility mode:

    Make older programs in this version of Windows - Windows help

    Make the programs more compatible with this version of Windows - Windows help

    I hope this helps.

    Concerning

    Megha Rawat

  • I removed the check mark to "Accept cookies from sites" in the Privacy tab, but when I restart Firefox the check mark is back!

    I removed the check mark to "Accept cookies from sites" in the Privacy tab, but when I restart Firefox the check mark is back! This problem started with version 3.6 and so I upgraded to version 5, but the problem remains. Any suggestions?

    Preferences are not saved

    https://support.Mozilla.com/en-us/KB/preferences%20are%20not%20saved

    Check and tell if its working.

  • I wish I had a client on my PC to communicate with the Lync server, but it does not work.

    Evaluation of the VHD Lync 2010 program

    I'm quite new to Lync and I'm trying to understand how it all works. I downloaded the virtual computer files and got successfully throughout the environment, but now, I would like to have a client on my PC to communicate with the Lync server but I'm not having any luck.

    Here are the servers that I have:
    DC
    Exum
    Lync-Qms
    Lync-Se
    SPS2010
    These are all in an internal network and I gave the Lync-SE server outside access, assuming that it's the server that my client needs to communicate with because he runs the Lync server. Initially, I was getting a certificate error. I exported the certificate of the server DC, installed on my client and the client toward the DC server who gave me the certificate number, but now I get an error that the server is temporarily unavailable. I'm far from base here?

    Hello

    Thank you for visiting the Microsoft answers community site. Your question is better suited for the IT Pro TechNet public. Please post your question in the TechNet Windows 7 Server forum.

    I hope this helps.

  • We have added a few custom MW steps, but we do not see them when navigate

    We have added a few custom MW steps, but we do not see them when access to the category.

    1 MW version: 2.18
    2. version database where the MW is installed: 10.2.0.5
    3 steps to reproduce the problem.
    a. add custom step.
    b. assign the new catalog to the engineer
    c. connect as an engineer
    d. cannot see the new stage in the process drop-down list.

    Thank you

    It is more often the filter information that you put on the market.
    You must use the voucher:

    Shortname/State of the request
    To/from versions

    for what have installed applications. It is documented in our FAQ, MOS, Note 405263.1. If you have empty values or inappropriate in these areas, then you will not see the stage.

    -Vikki
    Product Manager for the Maintenance Wizard

  • my friends in my hotmail contact list to receive emails from me that I won $ 53 but I did not send a

    original title: how they use my hotmail

    my friends in my hotmail contact list to receive emails from me that I won $ 53 but I did not send a

    Submit all Hotmail queries on the forum right here:

    Windows Live Solution Center
    http://windowslivehelp.com/

  • I bought the 14 for Mac adobe elements.  Is there a download error.  I received an email with the serial number, but when I went on the site to download the illustrated product was 14 for Windows.  What is the download link for adobe elements 14

    I bought the 14 for Mac adobe elements.  Is there a download error.  I received an email with the serial number, but when I went on the site to download the illustrated product was 14 for Windows.  What is the download link for adobe elements 14 for Mac?

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    -Cloud desktop http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html

    -Cloud Getting Started https://helpx.adobe.com/creative-cloud.html

    -you will need to enter your original serial number during the installation for non-Cloud programs

    - or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

  • HY, I used to use your adobe photoshop cs6 I have my laptop. some of the reasons for my laptop was not working, so I've restored my laptop. I have tried to reinstalled photoshop with old license No, but his does not work. what I would do.

    HY, I used to use your adobe photoshop cs6 I have my laptop. some of the reasons for my laptop was not working, so I've restored my laptop. I have tried to reinstalled photoshop with old license No, but his does not work. what I would do.

    Please return to the message sent to you.

  • Newbie inherited from 1950 with custom install incomplete rh5.1

    Machine: PE1950 2x2.0GHz Xeon, megaraid sas with 2 hard drives, RAID 1, DRAC5
    I have a little experience with the hardware and Linux, but not Dell machines.
    I just inherited this machine (14 months) that the previous administration began a custom installation of Red Hat 5.1. which means that it installed directly from media Red has. We wanted a custom installation of no partition, no X-Window, etc. better control disc. Is that a machine of Xen Dom0 lightened.
    In any case, the installation has been completed, saved the machined with NHN and updated with yum packages. However, since I've only worked with older hardware House I'm a bit baffled by what to do now to make sure that I have the right drivers, etc. for the machine.
    As stated in the Dell PowerEdge systems Red Hat Enterprise Linux 5 Setup Instructions and important information, I installed the Dell dkms package, but I now have no idea what to do next.
    How can I find out what devices are in this machine that require special drivers?
     
    How will I know that I need to download the drivers from Dell (or ripping of the CD)?
    I would prefer not having to build whatever it is because, as I said, it is a bit lighter
    install; No X, no development tools, etc.
    I have a bunch more questions related to Dell suite of admin tools, how to perform the f/w updates, etc., but I'll keep those for now.
     
    Thank you!

  • Font color changes when downloaded

    Created a new site. seems perfect locally in the browser. During the site build DW "closed unexpectedly. After uploaded to the server of my ISP and read in the browser, certain colors of fonts has changed. I deleted and published to the server several times... same results. I posted another copy of the site... same thing... change of font color.

    I tried to download with FileZilla and had the same problem of font color change.

    My system: version 10.6.8 DW CS5, FireFox, Mac.

    How can I fix?

    Thank you

    Brown text, 'Topic Spangler and son', should be red.

    Nope, it's good Brown, since the rule for #content h2 in tan.css replaces the same rule in styles.css (the link to tan.css occurs later in the code than that of styles.css). Same reason for the

    tag. Remember the rule of the greater specificity in the CSS!

  • Help with unexpected photo color changes when loading

    Hello

    I have learned things for a few years and doing pretty good to the mounting

    photos like portraits.

    Recently edited portrait high key, when I compared the RAW CR2 file in flt along the side of the photos

    converted to psd Adobe, colors where change after the opening and saving to the psd format.

    The thing is that I did no changes.  I just open the raw file, then click Open edit thought go in ele.

    Once it opens as a psd, the colors have changed.

    Camera is set to Adobe RGB.  ELE set to manage colors for printing.

    Is this normal, or something I'm doing or not doing.

    Suggestions and recommendations requested.

    Txz.

    Will be

    I understand that you compare side by side on-screen:

    -l'image in the ACR dialog, without any changes

    -l' new image observed after opening in the editor and saved as psd and reopened in order to be able to compare side by side.

    I agree that you should not see any significant color change.

    Notes about your settings:

    -Camera set to Adobe RGB: good for parameter ignored with raw files, JPEG files (PSE, the choice between sRGB or aRGB ACR depends on the second parameter in the Editor: always optimize for printing). Are not relevant to your problem.

    -Always optimize for printing: refers to the raw data will be converted to aRGB for printing and shown according to your screen. This is the right setting, if you want to print in ARGB.

    So, there's nothing wrong with your settings.

    Y at - it a bad screen color profile saved on your computer? Which could happen with other software or screen attempt calibration tools...

    I can't help much in this situation, but it might be useful you have described the color differences s two views. For better visibility compare colors, beware of the surrounding parts of images: If you're on a light background (ACR) and the other in a dark (editor), you see exactly the same colors.

  • I want to launch Firefox with a blank page, BUT when I restart firefox, it loads the homepage

    I have reset start empty, but there is not.

    So just to confirm, in the general Panel of the Options page, you set

    "When Firefox starts: display a blank page.

    And when you close the Options page and open it again, your bet is still there.

    But when you close Firefox and run it again, it has changed to:

    "When Firefox starts: show my home page".

    There are a number of possible reasons for Firefox to lose your changes of parameters between session. Software that is designed to protect you against unwanted changes you blocks actually make changes sought. This includes Advanced SystemCare, and some other utility/privacy/security software with a 'navigation protection' or a 'protection home page"feature.

    This article has other possible explanations: How to fix preferences that will not save.

    If you find that Firefox remembers not change between visits on the Options page: you can have a different problem, as a generally unwanted program named SearchProtect who should be removed from the Windows Control Panel or a configuration file 'automatic' which locks your start setting. We can help you to further explore that if this seems to be the behavior.

Maybe you are looking for