LabelField with background bitmap file

I would like to show a LabelField with a background as (01.gif, the yellow circle is the bmp and the labelField is '1'). My code is as follows:

final Bitmap bmp = Bitmap.getBitmapResource("img/circulo_numero.png");
LabelField lblPaso = new LabelField("1", Field.FIELD_RIGHT) {
    protected void paintBackground(Graphics g) {
        g.drawBitmap(0, 0, bmp.getWidth(), bmp.getHeight(), bmp, 0, 0);
        super.paint(g);
    }

    public int getPreferredWidth() {
        return  bmp.getWidth();
    }

    public int getPreferredHeight() {
        return bmp.getHeight();
    }

    protected void layout(int width, int height) {
        super.layout(width, height);
        setExtent(Math.min(width, bmp.getWidth()), Math.min(height, bmp.getHeight()));
    }
};

However, I got results as indicated in 02.gif...

How can I solve this problem?

TIA,

Yamil

Sorry, I'm not your post earlier. In any case, here is an explanation:

Your number 1 is painted where LabelField wants to paint. Unfortunately, you don't try to control where he went to paint it or where it will be placed, by the way. Fortunately, there is an old creation of mine tailor-made for you. Here it is:

Re: ButtonField with background

Simply create a CenteringManager with the bitmap you want to use as a background, add your LabelField and enjoy.

Tags: BlackBerry Developers

Similar Questions

  • Problem with Listfield and expandable background bitmap

    Hello

    I struggled for a while to make this work, and after searching the forums and knowledge base, I can't seem to do right. What I try to do is:

    1 header is a bitmap expandable width of 1px to the bottom, more a company logo bitmap, with position fixed (only the items below it is scrolling)

    2. use a listfield, which contains 4 elements:

    -1 px wide image bitmap background for each line, repeat horizontally

    -1 px width bitmap image of background for the highlighted line, repeat horizontally

    -an icon bitmap for each line on the left side, and

    -a title text for each line

    Here is the screenshot and code what I've done so far, so the problem is:

    1. when I scroll, scrolls the header (what I want is to position of the header is fixed, only the listfield below is scrolling).

    2. the background image is only painted on the first line of the listfield, how can I do this with all the lines?

    3. How is - that replace you the default blue color on a bitmap background highlighted line?

    public class AjsScreen extends MainScreen{
    
        // constructor
        public AjsScreen() {
            super();
    
            // --- 1. Main Header --- \\
    
            //prepare images upfront
            final Bitmap bgHeader = Bitmap.getBitmapResource("bg-header.jpg"); // repeating background image for main header
            final Bitmap logoAjs = Bitmap.getBitmapResource("logo-ajs.png"); // company logo in main header
            final Bitmap bgMenu = Bitmap.getBitmapResource("bg-menu.jpg"); // repeating background image for main menu
            final Bitmap bgMenuRo = Bitmap.getBitmapResource("bg-menu-ro.jpg"); // repeating background image for main menu (highlighted)
    
            //images used as repeating background
            final Background backgroundHeader = BackgroundFactory.createBitmapBackground(bgHeader, 0, 0, Background.REPEAT_VERTICAL); //REPEAT HORIZONTAL ???
            Background backgroundMenu = BackgroundFactory.createBitmapBackground(bgMenu, 0, 0, Background.REPEAT_VERTICAL);
            Background backgroundMenuRo = BackgroundFactory.createBitmapBackground(bgMenuRo, 0, 0, Background.REPEAT_VERTICAL);
    
            //main header background, with stretched width, and fixed height
            HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH){
                public int getPreferredHeight() {
                    return 55;
                }
            };
            hfm.setBackground(backgroundHeader);
    
            //main header logo
            BitmapField bf = new BitmapField(logoAjs);
            bf.setPadding(2, 0, 0, 5);//clockwise from top, right, bottom, left
            hfm.add(bf);
    
            add(hfm);
    
            // --- 2. Main Menu --- \\
    
            ListField lf = new ListField(){ //4, USE_ALL_HEIGHT | USE_ALL_WIDTH
                protected void paint(Graphics graphics) {
                    // TODO Auto-generated method stub
                    super.paint(graphics);
                }
            };
            lf.setBackground(backgroundMenu);
            lf.setRowHeight(40);
    
            final Vector le = new Vector();
            le.addElement("Menu 1");
            le.addElement("Menu 2");
            le.addElement("Menu 3");
            le.addElement("Menu 4");
            le.addElement("Menu 5");
            le.addElement("Menu 6");
            le.addElement("Menu 7");
            le.addElement("Menu 8");
            le.addElement("Menu 9");
    
            lf.setCallback(new ListFieldCallback() {
                public int indexOfList(ListField listField, String prefix, int string) {
                    return le.indexOf(prefix, string);
                }
                public int getPreferredWidth(ListField listField) {
                    return Display.getWidth();
                }
                public Object get(ListField listField, int index) {
                    return le.elementAt(index);
                }
                public void drawListRow(ListField listField, Graphics g, int index, int y, int w) {
                    g.drawBitmap(0, y, bgMenu.getWidth(), bgMenu.getHeight(), bgMenu, 0, 0);
    
                    String text = (String) le.elementAt(index);
                    g.drawText(text, 0, y, 0, w);
                }
            });
    
            lf.setSize(le.size());
    
            add(lf);
    
        }
    
    }
    

    Thank you very much

    Yusuf

    «1. when I scroll, scrolls the header (what I want is in the position of the header is fixed, only the listfield below scrolls).»

    ListField will do this for you.  I suggest that you look at setTitle in the screen and put your part not scrolling in there

    '2. the background image is only painted on the first line of the listfield, how can I do this with all the lines?'

    Don't know (haven't looked hard) how your background is painted on the first line, but this line:

    g.drawBitmap (0, bgMenu.getWidth (), bgMenu.getHeight (), bgMenu, 0, 0);

    doesn't seem to work for your lines.  You need to paint the entire width like this.

    ". How do replace you line default highlighted in blue on a background bitmap? »

    There are a number of ways to do I think.  Is to determine if you paint the selected line and act accordingly

    (if (listField.getSelectedInde () == index) {...})

    } else {}

    }

    Some people I think drawFocus override for the ListField - if you're looking for tour you will find examples.

    I think there are other ways, I'm looking round I think that this question has been asked before.

  • How can I add narration on my project to the Director of windows with background instrumental music?

    How can I add narration on my project to the Director of windows with background instrumental music?

    Hi penny of Jaycee.

    You can see the following link to add the music to the narration. Make sure you import music files that are supported by Windows Movie Maker.

    Add music to your movie

    For more information, you can consult the following link:

    Add narration to your movie

    Hope this information is useful.

  • How to get the Director bitmap files to become transparent PNG?

    I'm new to the whole thing from adobe, and I have files I want to convert bitmap files in a CSE in images with transparency. Thanks for the help!

    Found: Re: how to export several members of the cast at a time?

  • vmotion bitmap file

    is it possible to see the vmotion on storage bitmap file?

    How VMware VMotion?
    The live migration of a virtual machine from one physical server to another with VMware VMotion is enabled by three underlying technologies.
    First, the entire state of a virtual machine is encapsulated by a set of files stored on storage shared such as Fibre Channel or iSCSI Storage Area Network (SAN) or Network Attached Storage (NAS). VMware vStorage VMFS allows multiple installations of VMware ESX® to access the same virtual machine files concurrently.
    Second, the active memory and precise execution state of the virtual machine is quickly transferred via a high-speed network, which allows the virtual machine to instantly switch from running on the host source ESX ESX to the destination. VMotion has kept the transfer period imperceptible to users to keep track of current memory transactions in a bitmap.
    Once the State of memory and the system whole was copied on the target ESX host, VMotion suspends the machine virtual source copy the bitmap to the target ESX host and resumes the virtual machine on the target ESX host. This whole process

    VMotion occur at the level of memory (bitmap) and, and not in storage Levl, you don't see in the data file of vmotion store because there is no. You can see the traffic mentioned above

    also read http://www.yellow-bricks.com/2011/04/13/vmotion-and-quick-resume/

    http://www.VMware.com/files/PDF/VMware-VMotion-DS-en.PDF

  • Export a .ai file to a bitmap file

    In Illustrator Scripting (VBScript), how can you export a file have to a bitmap file?

    In Illustrator, you can open a file I and by selecting the export option, you have a choice of formats and one of them is BMP.  How is it possible in scripts?  I look at the AIExportType, but BMP is not in the list.

    aiJPEG = 1

    aiPhotoshop = 2

    aiSVG = 3

    aiPNG8 = 4

    aiPNG24 = 5

    aiGIF = 6

    aiFlash = 7

    aiAutoCAD = 8

    I also have to do this same method of exporting to an eps file.

    The task is this:

    When a customer downloads an image file, we need to automatically export the file bmp and esp, so having 3 files (original upload, bmp and esp).  The types of files that we export so far, will be HERE, esp and pdf (more to follow I know).

    There are also information on each file.

    It is vector or bitmap?

    Color: RGB, CMYK or Pantone?

    There the text or curved or both?

    What is the DPI resolution?

    What is the size of the image?

    Any help would be beneficial.

    Thank you

    Tom

    You have some problems with the scripts in artificial intelligence. Not all menu items are exposed to scripts. 6 12 export types have no export option. Regarding the EPS, look at the EPSSaveOptions for the registration of an EPS file.

  • an email with an mp4 file is hung in my Outbox

    Need to empty my Outbox on my iPad. An email with a video file won't and I can't remove it. I want to remove it.

    Try a simple Reset: hold down the Home and Power buttons until you see the Apple logo (10 to 20 seconds), then try to delete it.

  • Is - this restore iphone with warranty .ipsw file?

    Hi, I have a small question, restore your iphone with a .ipsw file another empty version its warranty or not?

    Yes. Apple does not support return to a previous iOS.

  • Can save image only as a bitmap file

    For some reason when I now right click on an image and then go to send to "My pictures" I get only the options to save as a file art or bitmap file.

    can someone help so I can save it as a Gif file as I have always in the past

    Have you tried to copy and paste in "Paint" or "Photoshop" and then saving them?

    [ToshibaLife blogging site | http://www.toshibalife.com]

  • Background image files

    Do you like the picture background TOSHIBA files?

    I think most of us do, but they are usually available on the preinstalled only Windowses. However, in the case when you are doing your own installation (and you do not register before these background images), these files are not available.

    Could do us a weblace, where we can download these files, available for any user of Toshiba, who just wants to get the favorite background image? Perhaps, some circles of Toshiba's House and beautiful could appear on this site as well.

    Currently I am looking for the new SATELLITE design, which is included in the system of the M50. Someone would be kind enough to send it to me?

    Hello

    Background images are not available for download. As Meier said maybe it will be nice that all these files can be based on the download page. Maybe one day. :)

    Good bye

  • problem with the Finder - files and folders displaying incorrectly

    After acquiring a new iMac, I noticed a problem with the Finder - files and folders are displayed wrong (see table).

    This is what happens always after the files have been transferred from one folder to another. I was reminded of my days of using Mac OS in the 1980s when automatic setting of files was not so "automatic." I use Mac OS for decades and I don't remember the last time I had to think about GUI problems like that.

    Other problems in the graphical display of files and folders were introduced, such as when you have hundreds of files in a single folder, you end up deleting about 30 to 40 of them say in a particular section, and you end up with gaps of the ChartSpace where files used to be, that is the remaining files automatically rearrange themselves (fill in these gaps) - never. A week later, you open the folder, and the gap of GUI is still there.

    I decided to do a clean install of the operating system but nothing works.

    Is there some setting in Prefs I'm missing?

    Hi there highland99,

    Looks like your folder icons are not accommodating themselves automatically you plan to do. To me, this indicates that you have organize by the None value in the view menu. You can change the way files and folders are prepared automatically by clicking on view > reorganize by and selecting how you would like that fixed.

    Thank you for using communities of Apple Support.

  • DIAdem - import programmatically .csv files with. STP file without dialog box

    Does anyone know how to import programmatically with a .csv files. STP file without opening the import box dialog box every time?

    I've been through the forum and seen for .xls files and solutions through the help file which is recommended to use the ExcelImport command, but these do not seem to work for .csv file types.  I am currently using the DataFileLoad command to import the files, which works very well to load the .csv files, but it forces me to go to the. STP file for each file.

    Does anyone know a better way to import a file .csv programmatically?

    Wow... Who had a fraction of the time that does the method of the dialog box.  I'll have to revise the data portion my DiAdem Advanced manual Plugin.

    Thank you, Brad!

    Steve

  • I have problem with a .iso file that when I want to use I face the error "the file name is too long.

    Original title: name of a file

    Hello

    I have problem with a file .iso that when I want to use I'm dealing with error "the file name is too long" and I can't use this file anywhere for example: vmvare ' untraiso and even if I cannot write to cd or make a boot USB.

    I don't know how fix it.how I rename the file iso, shorter that I can use?

    Please help me.

    Thank you.

    Right-click on the ISO > rename > give a short name

  • Which programs are associated with the xcm files

    I found a folder in my folder system program (. 86) that I don't know or I don't know where it comes from. It has a bunch of XCM file in the known folder that cannot open my own computer, can not give me info on how to open and cannot tell me which of my programs, he joined. I want to delete it because it seems that a suspect case, but not because I can not check programs what or how much it may or may not be associated with.

    Sincerely yours, Aaron Baker.

    Take a look at this link:

    http://pcsupport.about.com/od/FileExtensions/f/xcmfile.htm

    Excerpts .....................................

    What is the .xcm file?

    Response: A file with the XCM file extension is a Concept exported CmapTools mapping file.

    How to open a XCM file:

    The easiest way to open a file XCM is double-click on it and let your PC decide which default application should open the file. If no program opens the XCM file then you have probably an installed application that can view and/or edit files XCM.

  • Problem with the executable files

    Hello all, I need a help from you...

    I use LV 2009 SP1 Professional Development Suite on Windows Seven and I have a problem with the executable files, a problem that I have ever found with other versions of LV (8.x, for example) and I'm a little surprised...

    In the attachment you will find an example of what I mean.

    There are two base screws, the main one (prova) and a Subvi (provasubvi). The main vi launches the Subvi and the Subvi simply create a chart. As you can see on the screws works fine, without any kind of problem.

    I also created the exe file, without specifying that no particular option... and 'magic' of the application does not work as I want. In particular, it seems that the Subvi is running, but the front panel will not be accessible.

    I also try to play with the Subvi construction structure and options, but nothing change.

    Did you ever solve something like that?... I would say that I thank you in advance for any suggestion...

    Andrea

    Hello andrea,.

    Looking at your project I've heard that you do not include the Subvi during the build of the project. SO I slightly modified. Please find the attachments.

    Thank you and best regards,

    srikrishnaNF

Maybe you are looking for

  • Can't get audio to Apple TV on my samsung tv

    When I was watching a program on my MacBook Air, I connected with Apple Tv wireless.  I could see the image that was on my computer and he played well, but there is no sound.  Thanks in advance for your help. Peptobizz

  • HP 500K6V69AV: Dual Boot

    This HP 500 desktop computer was purchased new directly on the website of HP and delivered may 7, 2015.  There is no other choice for Windows 7 Pro, so I accepted the default win 8.1 64 bit.  My intention was to use a previously purchased 240GB SDD c

  • I have a power shot sx HS 40 & need information about the use of filters with this camera? Thank you ~.

    I have a power shot sx 40 & would like information on the use of filters with this device? Thank you ~.

  • NULL.sys fails to start, error code 24

    Windows Vista on Sony Vaio laptop Device driverNo Plug-and-Play driversNull value Order status (available Start button, but does nothing)Check the solutions give 'could not load driver software. Already changed all the "Away Mode" disabled power sett

  • Service Packs 1 and 2 will be not instal

    Hello To install IE9, I need to install SP1 and then SP2 on Vista. All windows updates seem to be up-to-date. When I try to install SP1, the process takes about 2 hours. The final messages saying something like "100% complete", but then "SP1 will not