How to draw and the positioning of images in FieldManager using the method object?

How can I add and the positioning of my images in the position desired in FieldManagers?

I need to add more than 2 fields (HorizontalFieldManager/VerticleFieldManager) in my application and I draw an image using the method of painting ovverided.

NOTE: The image will be established if I do not use mainScreen.add (SeparatorField ()) or mainScreen.add (hori2), see below.

If I use mainScreen.add (mainScreen.add (hori2) SeparatorField ())... n then the horizontalFieldManger won't be empty, drawn in the output screen.

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.*;

public class BackgroundImage extends UiApplication
{
    private Bitmap backgroundBitmap;
    private Bitmap fieldBitmap;

    int width, height;

    public static void main(String[] args)
    {
            BackgroundImage theApp = new BackgroundImage();
            theApp.enterEventDispatcher();
    }

    HorizontalFieldManager hori2;

    public BackgroundImage()
    {
        //The background image.
        backgroundBitmap = Bitmap.getBitmapResource("jalan_logo.png");

        MainScreen mainScreen = new MainScreen();

        hori2 = new HorizontalFieldManager();

        HorizontalFieldManager horizontalFieldManager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT){

            //Override the paint method to draw the background image.
            public void paint(Graphics graphics)
            {
                System.out.println("come to here..!!");
                width = graphics.getScreenWidth();
                height = graphics.getScreenHeight();
                //Draw the background image and then call paint.
                graphics.drawBitmap(width/2, height/2, 150, 40, backgroundBitmap, 0, 0);
                super.paint(graphics);
            }            

        };

        //The LabelField will show up through the transparent image.
        LabelField labelField = new LabelField("This is a label");

        //Add the manager to the screen.
        mainScreen.add(horizontalFieldManager);

       mainScreen.add(new SeparatorField());
       mainScreen.add(hori2);
       hori2.add(labelField);

        //Push the screen.
        pushScreen(mainScreen);
    }
}

Help, please.

I have already pointed out the problem with USE_ALL_HEIGHT in first Manager add you to the form. Drop this style bit, otherwise sublayout your screen will generate an exception, and nothing appears!

If you want HorizontalFieldManager to be of a particular size, regardless of the height of managed fields, replace its sublayout:

HorizontalFieldManager fieldManagerTopBanner = new
         HorizontalFieldManager()
{
     protected void sublayout(int maxWidth, int maxHeight) {
        super.sublayout(maxWidth, maxHeight);
        int myDesiredHeight = ;
        setExtent(getWidth(), Math.min(myDesiredHeight, maxHeight));
     }

     protected void paint(Graphics g)
     {
          // g.setBackgroundColor(0x000000);//blue
             g.drawBitmap(100, 150, 100, 200, jlnLogoImg, 0, 0);

          //g.clear();
            super.paint(g);
     }
};

Tags: BlackBerry Developers

Similar Questions

  • How to design and the list in ascending order from the minimum to the maximum with 6 entries

    Hello

    How to design and the list in ascending order from the minimum to the maximum with 6 entries in Labview?

    It is easy to write in C++, but not in Labview, can be that I am new to Labview. I managed to get the 1st and the 6th after a comparison, but I can't get the 2nd, 3rd, 4th, 5th.

    and can I write language c ++ in Labview VI?

    Thank you.

    Try this:

  • How to draw all the info my old to my new laptop computor

    Original title: draw all the information in my old laptop to the new

    How to draw all the info my old to my new laptop computor

    Hello

    1. What are the operating systems installed on both computers?

    2 you want to transfer all the settings from the old computer to the new computer?

    You can use Windows Easy Transfer to perform the task.

    http://Windows.Microsoft.com/en-us/Windows7/products/features/Windows-easy-transfer

    Hope this information helps

  • extend ListField, how to get a valid result of getSelectedIndex inside the method object?

    Hi all

    I have replace the method object to extend ListField to create my own color ListField.

    I need to avoid the double drawRow between the method object

    and the drawFocus() method.

    inside the method object, I always get the 'bad' selectedIndex (previous)

    (or rectangular previous on getFocusRect()).

    my questions are:

    1. how to get current selectedIndex (or FocusRect) inside the method object when we extend ListField?

    2. is there any other method called before object, the method which returns SelectedIndex valid?

    3. how to avoid the double drawing between object and drawFocus()?

    Thank you.

    If everything you do is add your own color, and then you can do this by using a fillRect in the drawListRow method.  In there.  I have the code that did this, but only for lines not targeted, as it detects with:

    If (listField.getSelectedIndex ()! = index) {}

    //

    }

  • How can I add titles and ALT text to Images that are used as fill?

    I built a site and in most cases, all images are fillings.  I want to update the title and the replacement text, but do not have the option.  It seems that I can only do this to images that have been placed?  If this is the case - how to place an image on an area I want to be filled.

    Thank you

    The work around you are use is probably the best solution because there is no way to add the alt text of an image placed in a frame.

  • How to draw and edit double lines with Adobe Illustrator?

    I need tot draw road maps. This should be easy with the pen tool, but my problem is that I can't find a way to draw a double line with this tool. I've seen a lot of models and fancy border styles. Some do not have the lines double or even quadruple, but the problem is that they have an offset from the vector line and the space between the two lines (the edges of the road) cannot be filled. Somewere I also found a few pens called "Double line 1.1' to ' Double line 1.6' but they also had an offset from the vector and I could chance not regardless of the size of the lines and the interval between them."

    I'm looking for is a way to draw two lines in parallel and have tot option fill out the space between the two with a color or even a model.

    The color and the size of the lines should be variable to distinguish between several types of road.

    Y at - it a game's existing pencils for this? It would be nice to be able to attract not only the roads, but also railways and rivers!

    I'm certainly not the first person who needs to do that?

    I use HAVE version 6

    Here is a picture. You can adjust the color of each stroke by selecting the line in the appearance Panel, and then change the color in the little box. Your best bet is to save the appearance as a graphic Style, so you can apply it to any line in the future. Not necessary for a brush and easier to change.

  • How my history and the transparent cache without being put in place to do?

    One morning my internet history and cache magically allowed and my options are not set up to do. Since my history and cache have been very well and not affected. Could someone please explain any possible reason as to why he would do this.

    It is possible that Firefox did not close properly when he arrived.

    Try using ' Firefox/file > exit ' (Mac: ' Firefox > leave ";) Linux: "file > exit ') to close Firefox if you're doing that by clicking on the X close in the title bar.

    Using this method to close Firefox can work better.

  • g.clear () call to the method object refuses the development of drawing for checkbox

    Hello

    I have this custom field extend the CheckboxField, with him object method is overloaded as follows:

    protected void paint (Graphics g)
    {
    int bgColor = _fontStyle.getBackgroundColor ();
    If (bgColor! = - 1).
    {
    g.setBackgroundColor (_fontStyle.getBackgroundColor ());
    g.Clear ();
    }
    g.setColor (_fontStyle.getForegroundColor ());
    Super.Paint (g);
    }

    the _fontSytle is defined by the user and transmitted as a reference of custom style, everything works fine in a first time without g.clear (), but I soon found out when the background color is black, while the foreground is white, paint reverse color. So I added this g.clear () and the problem was solved.

    However, the compensation seems to graphics here refuses the development of drawing and I was not able to trace which is cleaned and what is the indicator for the development of design. BTW, the "g.isDrawingStyleSet (Graphics.DRAWSTYLE_FOCUS)" returns true.

    So I was wondering if anyone here can provide a diagnosis on what could be the cause and how to fix it. Thanks in advance.

    Christian

    Nope, the g.clear () must be called to display the colors correctly. As I said, it can work in some cases, but just mess up from time to time.

    So what I do now is take a workaround to override the drawFocus() as default

    protected void drawFocus(Graphics g, boolean on)
        {
            refreshFooter(on ? getLabel() : "");
            // customize draw focus logic here as the default one conflicts with the paint method
            XYRect rec = new XYRect();
            getFocusRect(rec);
            g.invert(rec);
        }
    

    Thus the development of drawing must rely on paint and so don't mess the color.

    In any case, thanks much for the reply!

  • How do I get the DB objects accessible by a Page APEX 5

    Hello

    Is it possible to know the DB objects like table, packaging used in a page. Example: A page can use the table for reports, package, functions for dynamic actions.

    I am able to find the APEX_APPLICATION_PAGE_PROC table, which gives information on the process on a particular page and also complete PLSQL used in the process. If you are looking for something similar but provides information for all dynamic actions, reports etc..

    Thank you

    Ankit

    User13090770-Oracle wrote:

    Please update your forum profile with a recognizable username instead of "User13090770": Video tutorial how to change username available

    Is it possible to know the DB objects like table, packaging used in a page. Example: A page can use the table for reports, package, functions for dynamic actions.

    I am able to find the APEX_APPLICATION_PAGE_PROC table, which gives information on the process on a particular page and also complete PLSQL used in the process. If you are looking for something similar but provides information for all dynamic actions, reports etc..

    Use the database object dependencies report, or that you found, create your own tool custom -based text searches in the views of the APEX.

  • How to manually create the matrix object?

    Hello expert, I'm creating a matrix report object manually, I found a few steps on google, but they do not work to success.
    Please help me to create a.

    Google as follows:

    To create a matrix object:

    1.

    The layout of the document view, click the tool framework to repeat in the tool palette, and then drag a rectangle to create an extensible framework.
    2.

    In the property inspector, frame repeating, set the Source property of the "column" for the matrix and set the property to print the down Direction.
    3.

    Again click the tool framework to repeat in the Toolbox, and then drag a rectangle to create a second frame stretch, intersecting the first extensible frame.
    4.

    In the property inspector, frame repeating, set the Source property of the 'line' of the matrix and set the Direction of printing throughout property.
    5.

    Drag a rectangle around two expandable chassis to select, and then choose Insert > layout matrix.

    This creates a matrix object that represents the intersection of two Extensible frameworks. For example:

    Figure 4-1 example matrix object
    Shows the intersection of two rectangles
    Description of the "object of Figure 4-1 example matrix"

    6.

    Double-click the matrix object to set its properties.


    Thank you best regards n
    Yoann

    Hello

    You must select the two images (ctrl + click on the two fields) before you choose Insert > layout matrix.
    It should work.

    Kind regards
    Alex

  • How to 'tab' to the next object

    I am above all a Flash developer, and I'm used to the tab between the objects on the stage. I got art of a designer who I am cleaning for import in Flash. Many of these files have "stuff" in a group causes the group to be more physically it is visually. I can click on each object in the layers panel to understand which is the offending object, but it would be more easy/fast if I could use the keyboard to scroll through the items. Y at - it a keyboard shortcut that works for this? Tab in Illustrator has rather alarming affects.

    # Handling of objects AI is totally arbitrary and internal ID does not follow a linear logic that would allow cycling through them with all the keys.

    Mylenium

  • How can I count the fields object?

    Hello...
    I have a problem with the type of object...
    How can I count the number of fields in a generic object?

    For example, this object has 3 fields...

    Var sam:Object = new Object;
    Sam ["age"] = '2'
    Sam ['name'] = 'b '.
    Sam ['hair'] = 'x '.

    Object does not have a function like .length or similar...
    Maybe there's anithig as NumberFields(myObj:Object):int. ...
    any tips? ^__^

    Thank you very much! : D

    You can do this:

    var iCount:int = 0;
    for each (var prop in sam)
    {
    i ++ ;
    String var = sam [String (prop)] as String;
    }

  • Question about rom 9900, override the method object failed

    Before I update the ROM (9900jAllLang_PBr7.1.0_rel2435_PL5.1.0.622_A7.1.0.862_AT_T.exe) for my 9900, I can easily overrides the method of object to change text styles or field label, for example the size of the font, color of the text and so on.

    But, after update, I can always control the color of text, except the font size!

    I can make sure my codes worked properly 'before', I think this must be a problem of system because all my apps cannot resize the font size more!

    Is there any other way to solve this problem? I need your help, thank you! ~

    Code looks OK, but I would like you to try something.  Can you please set the font for the LabelField rather than change the paint of duing fonts.  Then change this:

    LabelField = about new LabelField ("about aid and", USE_ALL_WIDTH |) LabelField.ELLIPSIS) {}
    public void paint (Graphics g)
    {
    g.setFont (Font.getDefault () .derive (Font.BOLD, Font.getDefault () .getHeight (Ui.UNITS_pt) + 2, Ui.UNITS_pt));
    Super.Paint (g);
    }
    };

    to something like this:

    LabelField = about new LabelField ("about aid and", USE_ALL_WIDTH |) LabelField.ELLIPSIS);

    about.setFont (Font.getDefault () .derive (Font.BOLD, Font.getDefault () .getHeight (Ui.UNITS_pt) + 2, Ui.UNITS_pt);)

  • How to draw and animate like that to the PS CS6

    Hey, the owner of the video told me that he did with the ps all the animation, a tutorial that I want to learn about:
    Gear 4 (Fan Animation) / Deutsch - YouTube

    The characters are manga.

    Plenty of tutorials on Photoshop animation appear when search you the Web. Here are a few. The top one is for CS6, and others are for later versions.

    Hamilton shoots Episode 5: Animation in Photoshop CS6 - YouTube

    Create image animations in Photoshop

    Create Animations in Photoshop

    Animation of Photoshop techniques - Alex Grigg

  • How to color and the number of items vary continuously cursor instead of the time?

    I did an animation flash simple as below:

    the first key frame: the second keyframe:

    1.jpg2.jpg

    I want to create a slider to make the color of the rectangle varies from red to yellow by the cursor permanently ' movement rather than the hour and make balls fewer 15-8 at the same time.

    could you give me some advice about this?

    Thank you very much.

    Do you understand how to operate the cursor using code to read its value?  You will need to consider the issue to do this.

    What you can do, is get the yello rectangle be a movieclip which is located on the red rectangle and use the slider to control the alpha of the yellow rectangle from 0 to 1 property.  In this way the yolk will fade gradually while sliding.

    You'll then need to do is to find a way to make the number of dots that appear cut from 15 to 8 for the same interval of the cursor.  You must use the fractional value of the scabbard to decide how many points appear or not appear.

    You should not start new assignments for the same subjects you arlready have validations for the.  Do so in the future could lead to them being deleted.

Maybe you are looking for