How to set the background color of the title?

Generally, the title background color is black and the other area of the main screen is white. I want to set the background color of the linear gradient background as blue or something. I try the following 2 ways, but there is always a black line at the bottom of the title bar.

      Background background = BackgroundFactory
                .createLinearGradientBackground(0x00ff0000, 0x00ff0000,
                        0x0000ff00, 0x0000ff00);
        LabelField title = new LabelField("Hello World Demo",
                LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        title.setBackground(background);
        setTitle(title);
       LabelField title = new LabelField("Hello World Demo",
                LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);

        HorizontalFieldManager hrzManager = new HorizontalFieldManager() {
            protected void paintBackground(Graphics graphics) {

                graphics.setBackgroundColor(0x00382B79);
                graphics.clear();
                super.paint(graphics);
            }
        };
        hrzManager.add(title);
        setTitle(hrzManager);

Hello

I think that there may be a problem using the default setTilte() method.

Have something by default, behavior with the device.

It may be a way to customize the default title to remove the black line at the bottom of the title bar.

But I suggest an alternative that will behave like the title bar without using the setTitle() method.

You can use something like below to get your condition.

import net.rim.device.api.ui.*;import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.container.*;import net.rim.device.api.system.*;

class TestScreen extends MainScreen{

    private VerticalFieldManager verticalManager;    private HorizontalFieldManager hrzManager;

    TestScreen()     {            super(NO_VERTICAL_SCROLL);

        LabelField title = new LabelField("Hello World Demo",                        LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);

        hrzManager = new HorizontalFieldManager()         {            protected void paintBackground(Graphics graphics)             {                graphics.setBackgroundColor(0x00382B79);                graphics.clear();                super.paint(graphics);            }        };        hrzManager.add(title);        this.add(hrzManager);

        //rather than  adding component in the mainScreen        //add components in this verticalManager and then        // add this manager to mainScreen          verticalManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)        {            /*              public void paint(Graphics graphics)            {                graphics.setBackgroundColor(0x00ffffff);                graphics.clear();                super.paint(graphics);            }            */                        protected void sublayout( int maxWidth, int maxHeight )            {                int width = Display.getWidth();                int height = Display.getHeight() - hrzManager.getHeight();

                super.sublayout( width, height);                setExtent( width, height);            }        };

        ButtonField button1 = new ButtonField("Button1");        ButtonField button2 = new ButtonField("Button2");        ButtonField button3 = new ButtonField("Button3");        ButtonField button4 = new ButtonField("Button4");        ButtonField button5 = new ButtonField("Button5");

        verticalManager.add(button1);        verticalManager.add(button2);        verticalManager.add(button3);        verticalManager.add(button4);        verticalManager.add(button5);        this.add(verticalManager);

    }}

Concerning

Bika

Tags: BlackBerry Developers

Similar Questions

  • How to set the title when using InvokeManager (MediaPlayer)

    Hi Im using InvokeManager to play the video file (Media Player)

    How to change the title when media player to play the video (above)-> it by default uses the name of the file being played

    but I want to change this

    How to do this?

    Thank you

    Try this

    InvokeManager * invokeManager = new InvokeManager();
    InvokeRequest cardRequest;
    cardRequest.setTarget ("sys.mediaplayer.previewer");
    cardRequest.setAction ("bb.action.OPEN");
    cardRequest.setUri ("* video url *");
                QVariantMap map;
    Map.Insert ("contentTitle", "My title");
    QByteArray requestData = bb:psObject::encode (map, NULL);
    cardRequest.setData (requestData);
    Response InvokeTargetReply * = invokeManager-> invoke (cardRequest);

    Note: Mark your post as solved, if this solves your problem

  • How to set the title panel without using the Manifest.xml

    Hello guys,.

    I would like to know how to the the title of the Panel without using the manifest file.

    A C++ plugin is responsible for the creation of a menu entry. .

    He is also responsible of loading-unloading the extension basic HTML code.

    So in my extension manifest file, the following line has been deleted:

    < menu > my Panel Extension 1 < / Menu >

    After doing this, my extension Panel has more no title.

    What I would do, it is programmatically set, she don't know how to do!

    Any help would be appreciated.

    THX,

    Thomas.

    I found the solution to my problem!

    To find out how, follow this link: https://forums.adobe.com/thread/1731552?sr=inbox

    Thomas.

  • How to set the title of the dialog by program

    I want to use a variable for my title of popup dialogue so that I can set dynamically based on the code in my grain of support. I thought I could create a variable in my grain of support then go in the expression builder for the title of the dialog box and select this variable, but the variable does not appear in the list. If this isn't the right way, how to create a dynamic title for my dialogue? I use jDeveloper 11.1.1.4. Thank you.

    You have created a get accessor and a Set accessor method for your variable in the bean?

    Timo

  • How to set the title button in two lines

    Hi all

    Someone can give me a code example or an idea that can help me to define the button title in multiline, mean that I want to print the date currunt as '2009-12-11 11:42:45 ' in two lines on the title of the buttonfield.

    I tried to use the "\n" character to break the line, but it was not a job for me. I put in a title, for example,

    String title = "/ tej n Hi how are you?

    ButtonField btn = new ButtonField (title);

    Add (BTN);

    But it's not working.

    Thanks in advance,

    Using custom field, we can achieve it. More wire has the solution for you

    http://supportforums.BlackBerry.com/T5/Java-development/multi-line-ButtonField/m-p/94564#M10529

  • How to set the title of the project?

    I wish my file name to be independent of the Captivate name written at the top of the animation window. I can't find a place to choose this name. Right now, it's a little strange because I renamed the file outside Captivate, then he is a former name.

    Hi Chris

    If the offered suggestion seems to fail for you, take a look at the file > properties (Captivate 2) or change preferences (Captivate 3).

    You are probably interested in the field "name of the project. Oh and Captivate 3, you must first of all, click on the "General" of the new Preferences dialog box node.

    See you soon... Rick

  • Set the title of the window dynamically

    Hi all

    I am the creation OFA custom page for ads as system will be unavailable between xx and xx hours. I wanted to make the title of the window and the dynamic message and can be configured easily.
    So, I created page main region (MainRN) and the title of the window to the left as white. The page contains RawText point. My controller sets the title and the text of FND Messages in the ProcessRequest method.

    Text is displayed but it is NullPointerException as (OAPageLayoutBean) p1.findIndexedChildRecursive ("MainRN") returns NULL.

    Here is my page structure.

    xxAnnouncementPG
    MainRN (Style of the region: pageLayout)
    Announcement (Style element: rawText)

    Below is an extract from the ProcessRequest in my controller

    Game title
    OAPageLayoutBean mainrn = (OAPageLayoutBean) p1.findIndexedChildRecursive ("MainRN");
    System.out.println ("mainrn =" + mainrn);
    String title = p0.getMessage ("XX", "XX_ANNOUNCEMENT_TITLE", null);
    mainrn.setWindowTitle (title);

    Ad text
    Announcement of RawTextBean = (RawTextBean) p1.findChildRecursive ("Announcement");
    String msgtext = p0.getMessage ("XX", "XX_ANNOUNCEMENT_TEXT", null);
    announcement.setText (msgtext);

    I have
    used code below to discover all the childs in my page, but it shows only the "corporateBranding" and "messages".

    * for (Enumeration e = p1.getChildNames (); e.hasMoreElements () ;)) {*
    System.out.println (e.NextElement ());
    *}*

    How to set the title of the window dynamically? How to know all the recursively childs to the title of a page?

    Thank you
    Kishore

    Use pageContext.getPageLayoutBean () to get the handle of the PageLayout Bean. Subsequently, you can use setWindowTitle to define the message.

  • 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 set the color for background ChoiceBox point to ChoiceBox with css?

    How to set the color for background ChoiceBox point to ChoiceBox with css?

    I need to change the backgound color list items.

    I tried with the following code, but it's not help to:

    {.context-menu .choice-box

    -fx-background-color: Red;

    }

    .choice-box .menu-item {}

    -fx-background-color: red;

    }

    In Java 8, either of your selectors should work.

    In Java 7 (JavaFX 2.2), you need of the following workaround:

    #choice-box-menu-item {
         -fx-background-color: red ;
    }
    
  • How to set the background color of a page_item?

    I was pasting "background-color: #5CD65C" in a number of places, like the 'attributes of the HTML table cells' under the label and the tabs of the item, but get no results. Can someone tell me how to set the background color of a cell, please?

    Hi Doug,.
    One method is to add a style to your header html in page attributes, if you add the below css styling and the change of the name of the item page (#P2_FIRST_NAME) to your he should style correctly:

    Thank you

    Paul

  • How to set the page background color

    I would like to create a book with blank pages, some gray and some black backgrounds.  In photoshop, it's easy to set a background color, but I don't see how to do this in InDesign CS4.  It should be easy, but I can't find the answer anywhere!

    Thanks for your help.

    Paul

    Unless you intend to actually print the background color, rather than printing these pages in stock color, you should put a layer of sepatate behind everything and be together the nonprinting layer or turn off the visibility before the release.

    In addition, if the majority of the publication will be released on colored stock, you can change the shade [paper] to show something close, so you will not need to have a special background for these pages.

  • How to set the background color in a scene?

    I'm new to JavaFX and just started my first program of FX.  I created a FX 7.3 NetBeans project and the project runs correctly.   All the samples in the JavaFX samples download work as well.  But when I try to do something as simple as the definition of the background on my first stage color to black, I can't make it work.  I find examples and documentation telling me that what I do should work, but it's not.

    Scene = new scene (root, 300, 250, Color.BLACK);

    scene.setFill (Color.BLACK);

    primaryStage.initStyle (StageStyle.UNDECORATED);

    primaryStage.setTitle ("Hello World!");

    primaryStage.setScene (scene);

    The two lines "BOLD" are marked as errors.  Unfortunately, I can't find a way to copy the error popup text in the IDE, so I'll summarize.  The two lines are errors that say that I gave a color but paint was expected.

    Is there something that I am missing? Can it be this hard set a background color in JavaFX?

    Thank you.

    Hello. Choose your imports. You probably

    import java.awt.Color;
    

    Instead of

    import javafx.scene.paint.Color;
    
  • How to set the background Transparent

    Hi all

    I'm very new to blackberry development, can someone tell me how to set the background transparent.

    Thank you

    Kishore P.

    Use this code:
    VFM VerticalFieldManager = new VerticalFieldManager () {}
    //...
    }
    vfm.setBackground (BackgroundFactory.createSolidTransparentBackground (Color.COLOR_YOU_LIKE, 0));

  • How to set the stage (or the background in the stadium?) to be transparent?

    How to set the stage (or the background in the stadium?) to be transparent?

    Thank you

    Gary

    Select the scene.

    Color sample

    Then set the Alpha slider to 0.

    .

    Darrell

  • How to set the color depth

    try to set the color of amd's message color depth less than 24. How to set the highest color depth?

    If your computer allows you to change this setting, it will be located in the "Control Panel > display > resolution > Advanced Settings > Monitor tab > screen colors.

  • How to set the color of foreground to EditField

    Hi all

    I added EditField to display new EditField("About:","",1024,EditField.FILTER_DEFAULT).

    Now I want this editfield foreground color value. But there is not setForegroundColor() as setBackgroundColor() in the EditField class.

    Can someone tell me how to set the color of foreground to EditField?

    I think so

    You can change the foreground color by replacing your method of painting:

    That is to say

    editField = new EditField()
    {
        public void paint(Graphics g)
        {
          g.setColor(Color.GRAY);
          super.paint(g);
        }
    };
    

Maybe you are looking for