change the color of the development of the ButtonField?

Hello

I want to change the accent color is blue on ButtonField...

That is to say when the focus is on the button its development of color is blue I want to change the accent color...

Which method I should replace...?

Thank you

import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;

public class CustomButtonField extends Field
{

    private int backgroundColour = Color.GRAY;
    private int highlightColour;
    private int fieldWidth;
    private int fieldHeight;
    private String text;
    private int padding = 8;

    public CustomButtonField(String text, int highlightColour)
    {
        super(Field.FOCUSABLE);
        this.text = text;
        this.highlightColour = highlightColour;
        Font defaultFont = Font.getDefault();
        fieldHeight = defaultFont.getHeight() + padding;
        fieldWidth = defaultFont.getAdvance(text) + (padding * 2);
        this.setPadding(2, 2, 2, 2);
    }

    protected boolean navigationClick(int status, int time)
    {
        fieldChangeNotify(1);
        return true;
    }

    protected void onFocus(int direction)
    {
        backgroundColour = highlightColour;
        invalidate();
    }

    protected void onUnfocus()
    {
        backgroundColour = Color.GRAY;
        invalidate();
    }

    public int getPreferredWidth()
    {
        return fieldWidth;
    }

    public int getPreferredHeight()
    {
        return fieldHeight;
    }

    protected void layout(int arg0, int arg1)
    {
        setExtent(getPreferredWidth(), getPreferredHeight());
    }

    protected void drawFocus(Graphics graphics, boolean on)
    {

    }

    protected void fieldChangeNotify(int context)
    {
        try
        {
            this.getChangeListener().fieldChanged(this, context);
        }
        catch (Exception e)
        {}
    }

    protected void paint(Graphics graphics)
    {
        graphics.setColor(backgroundColour);
        graphics.fillRoundRect(0, 0, fieldWidth, fieldHeight, 8, 8);
        graphics.setColor(Color.GRAY);
        graphics.drawRoundRect(0, 0, fieldWidth, fieldHeight, 8, 8);
        graphics.setColor(Color.WHITE);
        graphics.drawText(text, padding - 1, padding / 2 + 1);
    }
}

Tags: BlackBerry Developers

Similar Questions

  • Change the color of the development of the action bar

    Hi all

    Please help me on how to change the color of the focus of the action bar, the default color of the action bar is blue I want to change it to yellow.

    Thanks in advance.

    Do not think, that can be done with the latest version of the SDK.

    See this http://supportforums.blackberry.com/t5/Cascades-Development/How-to-change-tabbed-pane-background-col...

    -Dishooom

  • change the color to buttons

    Hello

    I have a series of buttons placed side by side. I'm changing the focus from one button to another using the navigation keys. Now the problem is the update is not clearly visible. Is there a possibility to do?

    I had an idea to use the option of color change, when the focus is on a button changes color to some specific color and the rest in a few other specific colors. But I am not able to implement clearly. so please give me an idea...

    Thanking you,

    sushmith

    If you want to change the color of a button, you must watch what kind of button that you use.  Not all the buttons can have their changed colort.

    If you are looking for a professional to look at it, you don't want to do a colorbook either by changing each button in a different color.

    What you can do is put behind each button an LED indicator that is slightly larger then the button itself.

    When the button has the focus, set the indicator.  And it will turn on.

    It's a little more work, but it looks so much nicer.

    Personally, I don't like to mess with colors.  I like the simplicity.  That's why I use systembuttons, who already have a blue surface when they have developed

    Hope this helps

  • change the border color of an image control

    Hi all

    I shows 30 photos on the façade by using an image control. I want the user to select 12 peaks of 30 photos.

    is there an interactive way to show what image has been selected. I thought that it would be OK to change the color of the border of the control.

    I would like to know how to change the border color of th and you are really welcome if you have a better way to say what peak has been selected.

    Thank you

    Ritesh

    Hi Ritesh,

    in my LV7.1 installation I could change bordercolor using the tool to color in development mode, but I couldn't find a property to change the colors by programming...

    So my advice would be to put a little bigger Boolean flags (or color boxes) behind the indicators of the photo. When the image is clicked/selected just change you the color of the underlying Boolean value. In this way imitate you the colorchanging of an indicator of the photo border...

  • How can I change the color of my fonts on the desktop icons?

    I need to change the color of the text on my desktop icons, how do I do this?

    Hello petejgraham,

    Thank you for visiting the Microsoft answers community.

    The color of the icon is not available for change in Windows by their design. There are however third-party applications that can allow you to have more control over development within Windows. You can search on your search engine preferred, for exactly what you are wanting to do, and it will give you options.

    Hope this helps

    Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Chris.H
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How can I change the background color of a button in .qml

    Hello, everyone! I have a problem now.

    When I define a componnet in QML button, it has a white background color by default. While I want to change the background color, for example red.

       Container {
            layout: StackLayout {}
            background: backgroundPaint.imagePaint
            attachedObjects: [
                ImagePaintDefinition {
                    id: backgroundPaint
                    imageSource: "asset:///images/background.png"
                }
            ]
            Button{
                text: "button"
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Center
            }
        }
    

    I read the reference that write it a clickable button with a height fixed and the visual aspect of the button is predefined and cannot be changed and so forth... look herehttp://developer.blackberry.com/cascades/reference/bb__cascades__button.html

    I tried this way to change the theme of the application. But I failed! See more details here http://developer.blackberry.com/cascades/reference/bb__cascades__themesupport.html

    How can I achieve this? Please give me help. Thank you in advance. Please forgive my bad English

    Hello

    Button style is predefined according to me. Dark theme can be activated in the bar - descriptor.xml, but it is applied to the application on a global scale and affect all other controls as well.

    You can use a container with background image instead of a button. Example code:

    http://supportforums.BlackBerry.com/T5/Cascades-development/button-with-a-background-image/m-p/21489...

  • Change the color of the bar GaugeField

    Hello.

    I would like to change the color of the bar in a GaugeField. My code is:

    int current = obj.getInt("nu_votos");
    final int color = BBUtils.hex2Rgb(obj.getString("nu_color"));
    GaugeField gf = new GaugeField("", 0, total, current,
            GaugeField.NO_TEXT) {
        protected void paint(Graphics g) {
            g.setBackgroundColor(color);
            super.paint(g);
        }
    };
    

    However, I still get the same blue color...

    TIA

    Yamil

    set up your own domain, it is not so difficult.
    or you can take a look on the field of gauge bitmap here:
    http://supportforums.BlackBerry.com/T5/Java-development/implement-advanced-buttons-fields-and-manage...

  • VerticalFieldManager - .setMargin (...). Is it possible to change the color of the margin?

    So I have a margin, but I would prefer it to be white.  Is it possible to change the color of the margin?

    Screen has a bug that is known for a long time with environments.
    Add a verticalfieldmanager, set a background that him and use instead the main Manager of the screens.

    For more information:
    http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

  • How to change the background color of TabbedPane?

    Hi all

    Is there any property to change the background color of the tabbed pane, IE change the black color by default tabbedpane to any other color or background image custom like this Ant. give me a link or idea to develop.

    Thanks in advance.

    Kind regards

    Lakshman K

    Currently, there are light and dark themes available for user interfaces. Other than you can change the background color since it's the tide with the theme of the brand. Here's more info on the themes of the interface user of Blackberry.

    https://developer.BlackBerry.com/native/documentation/Cascades/UI/themes/

  • How to change the background color of a button

    Hello world

    I used a buttonfield, and I want to change the background color of the buttonfield. How would I do that? Can someone help me?

    Thanks in advance

    you create a custom class fot achiev

    Look at this link and see my Post. you will find this custom class of the button field.

    http://supportforums.BlackBerry.com/T5/Java-development/ButtonField-background-colour/m-p/602309#M12...

    ------------------------------------------------------------------------------------
    Kudo press to say thank you to the developer.
    Also, press accept it as a button when you got the Solution.

  • Change the color of the label dynamically in QML

    How to change the base on the value of text color? For example, I want the text to red if the value is negative.

    Hello

    Here is an example:

    import bb.cascades 1.0
    
    Page {
        Container {
            Label {
                id: label
                textStyle.color: text < 0 ? Color.Red : Color.Green
                text: "100"
            }
            Button {
                text: "Click me"
                onClicked: {
                    if (label.text < 0)
                        label.text = 100
                    else
                        label.text = -50
                }
            }
        }
    }
    

    Or, the legacy of the styles:

    import bb.cascades 1.0
    
    Page {
        Container {
            Label {
                id: label
                textStyle { base: text < 0 ? style2.style : style1.style }
                text: "100"
            }
            Button {
                text: "Click me"
                onClicked: {
                    if (label.text < 0)
                        label.text = 100
                    else
                        label.text = -50
                }
            }
            attachedObjects: [
                TextStyleDefinition {
                    id: style1
                    color: Color.Green // or Color.create("#00ff00")
                },
                TextStyleDefinition {
                    id: style2
                    color: Color.Red // or Color.create("#ff0000")
                }
            ]
        }
    }
    

    If you compare the colors or export c++, here is another example on how to do this:

    http://supportforums.BlackBerry.com/T5/Cascades-development/compare-a-labels-color-in-QML/m-p/218616...

  • change the background color of a dashboard page

    Hello

    How can I change the background color of a page in obiee 11g

    Thank you

    Any idea what is CSS?

    As said, you can't do anything with the HTML, you need to do is to CSS...

    If you've never seen CSS in your life, at least try to have a look online to get a basic idea of what it is and how it works.

    What you are looking for has also little or nothing to do with OBIEE because it's just web development in the end (OBIEE is a web application).

    
    

    Your toolbar to the browser developer, inspect a page of dashboard OBIEE and you discover that the white space in the middle where the content is has a class named associate DashboardPageContentDiv, by default there is also a white background color.

    Just change this one...

  • change the color of line based on the value of column 5 Apex in the classic report

    Version of the apex 5.0.0.00.31

    Standard universal theme

    Page theme default template

    Classic report

    Foldable report template

    Hello

    I know this question has been asked several times here, but I'm working on 5 Apex and need to know the correct way to do it in this version.

    I need to change the color of the text of the entire line (no background color) based on the value in one of the columns of the classic report. I have just two conditions, if the value of column = Yes, color should be red, otherwise it must be green.

    I am new to jscript and css, so appreciate if someone can tell me the solution with steps.

    I have already checked this link that changes the value of the column, need to do something similar to the whole line.

    https://tylermuth.WordPress.com/2007/12/01/conditional-column-formatting-in-apex/

    Hi coolmaddy007-Oracle,.

    Here's an example set up on the apex.oracle.com according to the specifications you gave: https://apex.oracle.com/pls/apex/f?p=35467:1

    Version of the apex 5.0.0.00.31

    Standard universal theme

    Page theme default template

    Classic report

    Foldable report template

    Here is how it is done:

    Create a dynamic action with the following specifications:

    Name: Give the appropriate name

    Event: After refresh

    Selection type: region

    Region: select your region classic report

    Condition: No strings attached

    Action: Run the JavaScript Code

    Fire on loading the Page: Yes

    Code:

    $('td[headers="JOB"]').each(function() {
      if ( $(this).text() === 'MANAGER' ) {
        $(this).closest('tr').find('td').css({"color":"red"});
      }
      if ( $(this).text() === 'SALESMAN' ) {
        $(this).closest('tr').find('td').css({"color":"green"});
      }
      if ( $(this).text() === 'CLERK' ) {
        $(this).closest('tr').find('td').css({"color":"blue"});
      }
    });
    

    NOTE: Download the selector appropriate for your knowledge $('td[headers="JOB"]') case using firebug/browser development tools.

    Items concerned: leave blank.

    PS: Changed the example to change the color of text instead of the background color.

    I hope this helps!

    Kind regards

    Kiran

  • How to change the color of red for areas outside of the gamut in preview soft proof?

    Hello

    I saw asked this question earlier and the response has been to not even bother with the test, but also to export as a JPEG file in RGB color space, and it is the event for you...  (Thanks for the great video, Digital Dog!) ...

    But...  Still, I was hoping to do a little test in the module development mainly in preview... However I am doing the test on a painting of a few tomatoes and the warning of the range and the tomatoes are all just a big block of red.

    I sure hope there is a way to change this color.

    Thank you!

    Anne

    Sorry, it does not exist.

  • How to change the color of the indicator of loading the default page?

    Hello

    I was wondering how to change the color of the indicator as shown in the photo below, the default page loading

    http://1drv.Ms/1kivj05

    I use Jdeveloper 11 GR 2 11.1.2.4 & Weblogic 10.3.6

    Best regards.

    Hello

    This will guide you to what you need to do.

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/15-custom-splash-screen-169144.PDF

    As Timo says you will need to locate the gift of animation edit and then create a new skin by using the new gif.

    Concerning

Maybe you are looking for

  • Delete files that I download via Firefox themselves

    Twice now, I downloaded files to work on through firefox. The first time I downloaded an excel file, worked on it for several hours, saved and then found that it has been completely erased from my hard drive with no record that there is such a file.

  • CAN protocol

    Hello I'm new on CAN protocol through the Robert Bosch ver2.0 part B specification CAN. I don't understand the following lines in page 63 "Note: Start / Wake up: If during the start-up, a single node is online, and if this node sends a message, it wi

  • QUESTION: Two different serial numbers for a device in MAX?

    The camera I use is a 34405A agilent.  It is connected via USB to a windows XP computer.  I was running my software from one day to the next.  When I came back I got an error saying that it could not communicate with the device.  I looked at MAX, and

  • I have 111 pictures to put on the disk, how?

    I'm unable to put pics on my DVD recorder, I get the error messages. He used to work, I would click on the album file and the wizard would deal with the rest, not now, puzzled.

  • I'm getting error .exe - image incorrect when I start the computer and click on anything

    I keep on getting error bad .exe continuous Image on my Windows XP machine. Help, please