Background color of the custom field

Hello

I create a custom field that is as shown in the attached display a bar graph.

I don't want to change the background color of the field of another color. I tried to overridding method paintBackground of the field as shown below:

protected void paintBackground(Graphics arg0) {
        arg0.setColor(Color.DARKGRAY);
        super.paintBackground(arg0);
    }

but it seems to have no effect. Could someone kindly help me with this. Thanks in advance.

Kind regards

S.A.Norton Stanley

Try this...

Create a class that extends the scope and implements DrawStyle

and override its Paint method... to set the background color

Draw the shape you want with the graphics object and either fill the area or set the background color.

THX

Rabi Ray

Tags: BlackBerry Developers

Similar Questions

  • How to change the background color of the horizontal field Manager

    How can we tell the background color of the horizontal field Manager (hfm) hanger

    If we should extend and override in ppaint, I tried

    I got color of hfm in tag I added to this

    all give me idea

    Try this:

            HorizontalFieldManager manager = new HorizontalFieldManager()
            {
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(0x000000FF);//blue
                    graphics.clear();
                    super.paint(graphics);
                }
            };
    

    Concerning

    Bika

  • Two sliders in the custom field definition

    Hi guys,.

    First of all, I want to thank all those who helped me to this day. This forum has been essential for blackberry dev work I do, and I would be screwed without you guys. That being said, I'm having a problem. I install a custom like this text entry field.

    (1) creates a vertical field Manager, assigned a background and resized image with setExtent(). (works fine)

    (2) created a new type of field and inserted in the vertical field Manager to make native look (almost works)

    The problem I have is that two sliders are appearing. Cursor #2 is dynamically updated as it should be, but the #1 cursor seems to be a "flawed slider. Please see the image below for details.

    The custom field is defined using the following code. If I remove the custom field, or cursors comes, so I am positive that it is the source of the problem.

        public class JustifiedEditField extends HorizontalFieldManager implements FieldChangeListener {
            BasicEditField ef;
    
            public JustifiedEditField(long style) {
                super(USE_ALL_WIDTH);
                ef = new BasicEditField(style) {
    
                    protected void onDisplay() {
                        setPosition(10, 17);
                        update(0);
                        //invalidate();
                    }
    
                    protected void update(int d) {
                        super.update(d);
                        setPosition(10, 17);
                        //invalidate();
                    }
    
                    protected void paint(Graphics graphics) {
                        graphics.setColor(Color.WHITE);
                        getFocusRect(new XYRect());
                        drawFocus(graphics, true);
                        super.paint(graphics);
                    }
    
                    protected void onUnfocus() {
                        invalidate();
                    }
    
                    protected void onFocus(int direction) {
                        invalidate();
                    }
    
                    /**
                     * Intercepts ESCAPE key.
                     * @see net.rim.device.api.ui.component.TextField#keyChar(char,int,int)
                     */
                    protected boolean keyChar(char ch, int status, int time) {
                        switch(ch) {
                            case Characters.ESCAPE:
                                // Clear keyword.
                                if(super.getTextLength() > 0)
                                {
                                    setText("");
                                    return true;
                                }
                        }
                        return super.keyChar(ch, status, time);
                    }
                };
                add(ef);
            }
    
            protected void sublayout(int width, int height) {
                super.sublayout(width, height);
                setExtent(width, 57);
            }
    
            public BasicEditField getEditField() {
                return ef;
            }
    
            public String getText() {
                return ef.getText();
            }
    
            public void setText(String value) {
                ef.setText(value);
                invalidate();
            }
    
            public void setChangeListener(FieldChangeListener changer ){
                ef.setChangeListener(changer);
            }
    
            public void fieldChanged(Field field, int context) {
                invalidate();
            }
        }
    

    I am totally stuck on this issue, any help would be really appreciated. TIA!

    I came up with an alternative solution. It turns out that I can use a transparent border to set the offsets to where the edit field must be located within the input Manager; thus eliminating the need to use setPosition.

  • How can I change my task bar background color and the background color of site Web

    How can I change my task bar background color and the background color of site Web

    It is white now and he won't let me see the search fields

    Hello

    Method 1: I suggest you to refer the link below which will help you change the color of your frames of windows, the start menu, the taskbar, and more.

    http://Windows.Microsoft.com/en-us/Windows7/change-the-colors-on-your-computer

    Change the colors on your computer: http://windows.microsoft.com/en-US/windows7/change-colors-on-your-computer.

    Method 2: Try the following steps, which would help you to change the background color of your Web site.

    (a) open Internet Explorer.

    (b) on the Tools menu, click Internet Options, and then click the general tab.

    (c) click on colors under appearance.

    (d) uncheck the box that says use Windows colors.

    (e) then click on background and change the color you prefer.

    General Internet Explorer Settings change: http://windows.microsoft.com/en-US/windows7/Change-Internet-Explorer-General-settings

    Hope this information is useful.

  • Question regarding setExtent and getPreferredWidth for the custom field

    I am trying to understand the difference between getPreferredWidth and setExtent, which relate to the width of a custom field.

    I create a field that may be greater than the width of the screen. The field is made up of cells (for example columns and lines or cells, such as a table). The cells contain text, shapes, lines, color, etc. When I display the field I only paint the visible columns on the screen and allow the user to use the trackball to accomplish the columns out of the screen.

    At present, getPreferredWidth returns the total width of the field without all the empty columns, is longer than the width of the screen. I use the same value in setExtent for width. GetPreferredWidth must return the size of the field that is painted on the screen - the total width less the width of the columns out of the screen? I have the same question about setExtent - width either in total, longer than the screen width or the width of the part of the field that is painted on the screen?

    If I use the width of what is painted on the screen or the other of these methods, then the width changes when the user scrolls through the field. As the user scrolls, I calculate the number of columns will agree to a width of the screen and paint these columns. Is it a problem to have the PreferredWidth and the setExtent change width? I read that setExtent is called only when the Manager sets this field, so that the changes will not be recognized.

    It seems to work in two ways in a few simple tests, but I was just curious as the value of width that is right.

    Thank you!

    Mark

    When a field has changed in a way that requires the update of the screen (for example, after scrolling offset changes), simply call invalidate() from this area. That will eventually lead to paint (Graphics) for the field. At this point, you return the update field. (If only part of a field - as a single cell - needs to be updated, there invalidate() versions that accept arguments where, for efficiency, you can limit the update for just this part.)

    If I understand your needs, you can achieve the effect desired in the paint method. You can use the current dimensions of the field, the cutting of the graphics area, and your internal roll compensates to decide what to paint and what to delete. Let your custom field leave white space where you decide of doesn't make is not part of a cell. There is no need to change the scope of the field.

    If you go about it by changing the dimensions of the field, and then you ask the system to play much more work he has to do. If the custom field is the only field on the screen, it won't make much difference in the behavior (although there may be performance). With more than one field, it can be weird effects. For example, suppose that your custom field is one of several fields in a HorizontalFieldManager and you change the field width. When the HorizontalFieldManager recalculates its own layout, it will change the horizontal position of the fields to the right. The effect on the user, I think, would be really confusing: as the custom field parade, parties to the right of the screen could bounce left and right as the changed width field. I can't imagine that's what you want.

    Here's another way to think about this: absent some bit of style, your custom field would prefer be exactly wide and high enough to show all without scrolling. So the width and height would be based on adding the appropriate cell widths and heights, regardless of what actually is on the display. (It's also a long time that you do not have something fanciful.) If the optimum height is a function of the width available - as with sheathed on the line of text - you would implement this logic in the layout method. You then have no use for autonomous preferred width and height).

  • How can set the background color of the status bar?

    Quote from the old forum:

    Comments: comments
    How can set the background color of the status bar?
    Posted the: July 17, 2008 02:56
     
    How can set the background color of the status bar?
    Using this code for the status bar:
    LabelField statusField = new LabelField ("Good Morning", LabelField.USE_ALL_WIDTH |) LabelField.NON_FOCUSABLE | LabelField.HCENTER)
    {
    int _backgroundColour = Color.LIGHTGREEN;
    public void paint (Graphics g)
    {
    g.setBackgroundColor (Color.RED);
    g.Clear ();
    Super.Paint (g);
    }
    };

    Font defaultfont = Font.getDefault ();
    Police smallfont = defaultfont.derive (Font.PLAIN, 12);

    statusField.setFont (smallfont);
    setStatus (statusField);

    When I ran the code you have above, my status background color was red.  Is not what you see?  If so, please provide the BlackBerry model and software version that you are testing.  You can find this under Options.

    Or if you try to do something else, please provide details.

    I tested this in the BlackBerry Simulator included with version 4.5.0 BlackBerry JDE (4.5.0.44).

    To do this in version 4.1, first call getColor and save the current color.  Then call setColor, setting the color to the color you want to use for the background.  After this call call fillRect, starting with 0, 0 and go to the size of the field (use this.getWidth () and this.getHeight () to get this).  This must fill in the field with your specified color.

    To allow the drawing of the default content of the field call setColor once again, passing in the original color, then call super.paint.

  • How to change the background color of the code written DW page but not the Web page...

    How to change the background color of the code written DW page but not the Web page...

    If you have DWCC2015, you can change to edit > Preferences > coloring Code and either choose a new theme (RecoGnEyes is the background dark code by default) or you can change it to what you want in the background field by default.

    2014 CC had no theme options, but you can change the background color in the same place.

    I think that some of the previous versions also had the option, but I don't have them on my machine to check.

  • Change the background color of the theme 25

    4.2.1

    Hello

    If someone has changed the background color of the page 25 of the theme which is white, could you please confirm how this was done. Looks like the sheet is a sort of a DIV and not the background as such. Basically, the entire page is white, including the tab, mused to creates a custom CSS and who calls in the model once the CSS is called, so that this portion of color can be changed.

    All of the suggestions.

    Thank you

    Ryan

    ryansun wrote:

    4.2.1

    Hello

    If someone has changed the background color of the page 25 of the theme which is white, could you please confirm how this was done. Looks like the sheet is a sort of a DIV and not the background as such. Basically, the entire page is white, including the tab, mused to creates a custom CSS and who calls in the model once the CSS is called, so that this portion of color can be changed.

    The required CSS is:

    /* Page body */
    div#uBodyContainer {
      background-color: #f0f4fa;
    }
    /* Active tab */
    header#uHeader nav ul.uMainNav li a.active {
      background-color: #f0f4fa;
    }
    

    4.2 these replacements at the level of the model can be included in the property section of Style sheet cascading in the page template Inline .

  • How to set background color of the text?

    I have a TextFrame: abcd

    I want to set the background color of the text "bc" is red

    How to set background color of the text?

    Who would be with custom underscore. Set the solid style, choose a color and to adjust the weight and offset of an underline, making it thick and move up behind the text.

  • Change the background color in the window transparent tools

    I understand the background color in the Tools window is used to make gradients and fill in the erased areas of an image. I want to change the transparent color so that I can fill in the field are deleted an image with a transparent background grid. How can I go about it? I'm using photoshop CS2.

    Hi there-

    Could you post a screenshot of your workspace, including your layers panel? It's a little unclear what exactly you're trying to do and the problem you are experiencing.

    Work you stumbled upon a locked background layer? A locked layer displays a small lock icon in the layers panel (as shown below). You will get the following result you are trying to select and delete a zone on a locked layer:

    What is the problem you are having? If so, just double click on the locked layer in your layers panel and click OK in the dialog box that appears towards the top. You should now be able to delete a selection and you end up with a transparent area:

    Again, if this does not resolve your problem, try to provide screenshots of your workspace.

    See you soon,.

    Kendall

  • Setting the background color of the line according to a column value

    Hello

    in a classic report, I want to change the record to the red background color if the value of a specific column is 'NO' in the folder. Please help me.

    Apex 4.1
    RDBMS 11.2

    Thanks in advance
    lukx

    Hello

    Use custom report template. This post might help
    Re: Highlight a line in a tabular form, based on a column in the row

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

  • Need of Javascript code to change the color of the text field

    Looking for a code Javascript change the background of textfield color and outline color in acrobat?  (without any reference to xfa)

    The background color is the field fillColor property: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.705.html

    and the outline color is the property of strokeColor: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.723.html

  • Table background color forms valdiation notification field

    Hello

    normally when you use validation forms tabular for the APEX 4. If the validation is triggered then an error occurs and the corresponding field becomes a red background color. I got a costumer where this has not happened. Only the validation error occurred.

    Where can I configure the notification against a tabular form background color. Could not find anything in the models, the report attributes, the attributes of the element or elsewhere.

    Hope for help. My question. Determines the background color in the postings in a table?

    Best regards

    Tobias
    -------------------------------
    http://Apex-at-work.blogspot.com/

    Tobias,

    Create your own class css as follows:

      
    

    Key word is *! important *!

    Here is the explanation:
    http://webdesign.about.com/od/CSS/f/blcssfaqimportn.htm

    Best regards
    Marko

    Published by: Marko Goricki, February 11, 2011 11:12

    Published by: Marko Goricki, February 11, 2011 11:14

  • How to change the background color or the height of the titleWindow header?

    Hey guys... so I popup a titlewindow on click of a button, and I was wondering if tehre was a way I could change the background color of the header of the titlewindow...?

    (d) in Builder 4, paste the following code:


           
       

    Using the mouse, select 'TitleWindow' and right click and choose "Open Declaration of skin" in the context menu. That should open up toward the top of the skin in a new tab and you can copy and paste in a new skin file.

    (e) use Alex's excellent suggestion above:


       
       
           
       

    TitleWindow title bar area gets bigger, but if you want to close the button to align vertically, you'll probably want to custom skin even when change the constraint superior to Red = '0'.

    Peter

  • change the background color of the interactive reports

    Hi all

    I'm trying to change the background color of the interactive report. Is there anyway where I could change the background color of report? My all other reports are using custom background color, but in the case of report interactive, I couldn't manage change its default background color.

    Thank you
    Manish

    Hello

    Sorry, you said custom background color, so I thought you had that. The color I put here is just white, so you may have to adjust to match your custom color

    Probably the easiest way is to create an HTML region without a model to 0 in the position after the page header. Can use it as the source of the region

    
    

    You can also put in the page template or an external CSS file.

    If your has begun on CSS I suggest that you spend an hour or two reading this site [http://www.w3schools.com/css/], it will save you hours more later any web development environment you use

    Kind regards
    Carl

Maybe you are looking for

  • Qosmio X 770 - 3D Vision does not a vision

    I have a new laptop that I just started working.I did everything to put in place including 3D vision read the instructions on the site FAQ, introduction of lenses, download the Nvidia 3D player and allowing the stereotopic thing. But 2D is for me so

  • reminder of report options

    This issue was discussed by different threads before. However, I am still not able to make it work properly. I have attached a simple sequence containing a single step and a report options reminder. I don't get a report named ".xml". Dynamic name is

  • my computer is locked

    How to lock my computer

  • I can get my inspiration dell 2550 to start...

    the blue screen appears and says:A problem has been detected and windows has shut down to prevent damage to your computer... Check for viruses on your computer. Remove the newly installed hard drives... .He is correctly configured and completed.Run C

  • Blue screen - Unknown stop code

    everytime I open a game in windows vista the BSOD comes out and restarts the computer laptop while advice on how to solve the prob, so I can PLAY!and thx in advance