Change the color of the text on the button click

Hi, how I would change the text with color while the application is running?

For example, when the user clicks a button, how can I change the color of the editfield with already inserted text?

I realize that I could add the editifled with different colors, but I was wondering if there is a way to do this without adding new editfield - like refreshing the editfield with different text color.

Help is very appreciated!

First, create your own custom class that extends EditField.

It can be as simple as this:

public class MyEditField extends EditField {
  private int _color = Color.BLACK;

  public void setFontColor(int color) {
    _color = color;
    invalidate();
  }

  protected void paint(Graphics g) {
    int prevColor = g.getColor();
    g.setColor(_color);
    super.paint(g);
    g.setColor(prevColor);
  }
}

Once you have this class, you can use it like this:

final MyEditField textEntryArea = new MyEditField(...); // any EditField constructor can be used

...
FieldChangeListener buttonListener = new FieldChangeListener() {
  public void fieldChanged(Field field, int context) {
    if (field == setToRedButton) {
      textEntryArea.setFontColor(Color.RED);
    } else if (field == setToBlueButton) {
      textEntryArea.setFontColor(Color.BLUE);
    }
    // etc.
  }
};
...
setToRedButton.setChangeListener(buttonListener);
setToBlueButton.setChangeListener(buttonListener);
...

Edit: fixed a few typos.

Tags: BlackBerry Developers

Similar Questions

  • How can I change the "right click" menu for a table control?

    Hello

    How can I change the "right-click menu" of a table control. I would like to be able to remove the ability to add or remove columns and maybe more selections. I want to keep the possibility of

    Add or remove lines

    Right-click on your table.  Then go to advanced-> DURATION Shortcut Menu-> Edit.

  • OAF Page expand to change the button action

    Hello

    We have a standard page of the OPS in iProcurement, where there are a standard change request button, which redirects to another standard page. We want to change the button action to call another custom OAF page. Please let me know how to do the same.

    Attached screenshot for reference

    Follow the steps below to create a button through customization.

    1. click on customize page where you want to create an element.

    2. find the area where you want to create

    3. click on Create icon, which opens a new window.

    4. Select the style of the item as button and give the values for the element.

    Browse link below

    Oracle concepts for you: Add a button to a Page of the OFA

    Also paste the error if you get none after following steps above.

    BR, FLS

  • Change the mouse click on display once for all the clicks?

    When you create a demonstration of the software in Captivate, I would like to change the mouse click default Visual to the custom effect 'blue circle' for all clicks.  Is there a way to change the default or modify all mouse clicks with an entry?  It is possible to change the shape of all occurrences of the mouse pointer by right clicking a mouse, but it doesn't seem to be a similar option for the click of mouse vizualized.
    Thank you, in advance.

    Try this option in the PI (Inspector):

    Kind regards

    Michel

  • Change the color of text on the button click

    I found many ways to fill out / change the box around a field (both types) but not a way to change the color of the font.

    I tried:

    Form1. Page1.wTextField1.TextColor = ['RGB', 0.5,0.5, 0];

    Form1. Page1.wTextField1.textColor = color.black;

    All hope?

    Try

    Form1. Page1.wTextField1.font.fill.color.value = "0,0,0";

    Steve

  • AS3 code to change the button text

    Hello, I drew a simple button in Flash from the components Panel. I gave the button the name of the instance of btn_one. In as3 does anyone know the code how to change the text of a button when users click on it?  For example, I would that my button to switch the following send text. When you click to. I have tried different methods of code but it fails every time. Any advice would be appreciated. Thank you

    If it is a button component, you can use the label property to change the text of the label.

    btn_one.addEventListener (MouseEvent.CLICK, changeLabel);

    function changeLabel(evt:MouseEvent):void {}
    btn_one.label = 'send ';
    }

  • SOLVED: Cannot change the button text


    I have a text entry box that requires the user to enter a specific phone number. After you enter the correct phone number, they click on a search button to go to the next slide. For the text entry area, I have the option "Display button" selected. I want to change the text of the search, rather than submit, say, button, but nothing happens when I double-click on the button. No matter what happens when I click with the right button and select Properties.

    Using Captivate, I should be able to change the text of the button, but it won't let me. Any ideas?

    Apparently, it's still a "undocumented features" of Captivate. To resolve this problem, I deleted the original text entry box and then inserted a new. This time, using the same options, I was able to change the text of the button. Go figure.

  • Submit the State does not change the button in the Contact form

    the function of sending work (I tried pressing "enter key" and the message was sent), but the button is very static. It does not change color when turning or when you press on it and does not respond when you press to send the message. Any idea?

    You probably have an invisible element overlapping your button. Everything on the page do a select for hilite and make sure you have nothing running in the key. You can also go to the layers panel and be sure that your shape layers are above everything.

  • How to change the button 'Go '?

    Hi all

    I want to change the format of the Go button in the guests at my custom background color. In folder oracleBI that I couldn't find on the 'Go' JPEG image that we saw in the page guests. Where can I find this JPEG file?

    Thanks in advance
    Kart

    Jin
    create your own button and placed this one in

    OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\b_mozilla_4\button_back_over.gif

    and restart OC4j and services...

    Thank you
    saichand.v

  • How to change the buttons on the back of menu bar to look like ff3?

    I love ff3 way of history-button or download looks more than ff 4 because it was more colorful. Well, it isn't that bad, but I tofit personas rotator personas and it is difficult to do what the button is especially when it is a dark character. Is there anyway to solve the problem or help about this stuff?

    Using a theme is the easiest way to replace the buttons.

  • Re: Satellite A300-1 MW: how to change the button to start the sonique player

    Hello

    I have a question.
    I want to change the option on one of the button control (this one with open windows media player) and it will open a Sonic player.
    I've read about change in winamp, but I can't do it in Sonic.

    Please help me!

    Hello

    Yes, I read this also on the Winamp.
    I tested and it s true that you can change the configuration of the key and he might start Winamp instead of WMP.

    But the fact is that these can be configured in the Winamp software.
    There is an option that allows the use of these buttons.

    I don t know the Sonic player, but I guess that it is not possible

  • Satellite U400-22n - how to change the button mute for Led lighting

    Hello

    I can't turn off lighting on shortcut keys. The shortcut key to disable the LED has decided to change himself to put on mute. Does anyone know how I can pass this mute button to turn off the lights, or simply how can I turn off?

    Thanks in advance,

    Andy

    Hello

    If you are using Vista, then you should have installed VAP (value added package).
    In Toshiba Assist-> optimize you will find the configuration of buttons of Toshiba utility.
    This utility allows you to configure the buttons again.

    You must choose your button and should point to the dimmer.exe file that is located in the folder C:\Program Files\Toshiba\TBS

    Assign the dimmer.exe to the light button and complete the configuration. This should help.

  • I want to change the button menu items menu blackberry

    In my blackberry app I want to erase the current option to menu point (Swith application, close, Select) and add new menu button menu options.

    I tried the below code but nothing is happening for me.

    if (blackberry.ui.menu.getMenuItems().length 0) {
          blackberry.ui.menu.clearMenuItems();
        }
        var item = new blackberry.ui.menu.MenuItem(false, 1, "Click Me", customMenuItemClick);
        blackberry.ui.menu.addMenuItem(item);
    
        function customMenuItemClick() {
          alert("user just clicked me");
        }
    

    I inserted ? in the config.xml file
    but no use.

    How to change the menu items

    I would consider removing those as bad practice of the user interface. They appear (as I know) in all the menus in all applications.

    If you use the command combined with separators feature, I think you will find that it is ok?

    I don't know how to remove these default items (did not seek either ;-)))

  • Change the image, click the Listview item

    Hi all

    I want to change the image of the listview element. When I touch on the element of the list the image is modified and after leave the key event the modified image remains same. Please solve my problem.

    Thank you & best regards

    Sanjit

    remove the other part of the setHighlight function. This means that when you leave the touch, the other party will not perform.

    Press on as if that solves your problem.

  • try to change the email address of the printer but do not have to change the button anywhere

    I just bought and installed an officejet 8600 and implemented on eprintcenter. It me with an e-mail address for the printer I want to change to something that I can remember. Have you looked online and saw that I need to click Edit next to my name, email address or printer but everywhere I look there is no button to change. Please can you help.

    Hello nads.

    To change the e-mail address of the printer, you will need to disable web services on control panel of the printer. Then re-enable web services and follow the process.

    Bravo!

Maybe you are looking for

  • How to use AutoComplete

    Firefox has AutoComplete for privacy facility?

  • AMD Radeon HD 7600 M Series drivers

    Hello world I have a HP Envy laptop m6 and I installed Windows 7 Professional (64 bit). Thanks to this forum I found all the drivers I need except the drivers for AMD Radeon HD 7600 M series.The hardware ID are: PCI\VEN_1002 & DEV_6840 & SUBSYS_18A51

  • Satellite A30 921: XP does not detect the Firewire IEEE 1394 port

    I have a satellite A30 921.There I link port aswell. My problem is that im trying to connect my camcorder dv via I LINK and this is the first time since I bought this laptop. But XP won't dectecting it. Can someone help me on this problem?

  • Drivers on Win 8.1 compatibility

    Hi all. I have this laptop DV6 that I just put in shape with Win8.1 pro 64-bit http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?OS=4063&LC=it&CC=it&DLC=it&sw_lang=&product=4049... Over ther in the list of available drivers with Win7 compatibility

  • How can I get the icon 'remove hardware safely '.

    do not have safely remove icon. How to do it