How to clear the text on the image

Hello

I have a screen with the background image (bitmap). I draw the text and other images on this background to aid graphics object and all looks ok when I show the screen - but only the first time because the next time background image is one containing all these designs on it.

I would like to know if it is possible to erase these drawings, so next time I can use background image to draw top again?

I use something like this:

String fText = "Text";
fBackground = Bitmap.getBitmapResource("background.png")

fGraphics = new Graphics (fBackground );

fvm1 = new VerticalFieldManager()
{     

public void paint(Graphics graphics)
{
   fGraphics.drawText(fText, 0, 0);

   graphics.drawBitmap(0, 0, fBackground.getWidth(),  fBackground.getHeight(), fBackground, 0, 0);

   super.paint(graphics);
}
}

Next time I want to draw text 'Text2' so I change variable fText to "Text2". How can I remove the 'Text' text before doing this?

Thanks in advance.

You really want to paint on the bitmap background to show change data.

One of the most obvious solutions is to have fields for that--both the LabelField and RichTextField are good for displaying text, BitmapField is good to display bitmaps (use setBitmap to change the image), GaugeField is ideal for the indication of the percentage, etc..  Add the fields to your VerticalFieldManager, use the margins and the bits of style such as FIELD_HCENTER to space and position them the way you want and enjoy. When comes a new value to display, change the field matching and nullity. This is the right way to do these things.

Of course-, since you seem to be attached to the use of the graphics directly - the quick and dirty approach is just to paint directly on the screen using the Graphics object passed in object.  Something like this:

fBackground = Bitmap.getBitmapResource("background.png")

// fGraphics = new Graphics (fBackground );

fvm1 = new VerticalFieldManager()
{     

public void paint(Graphics graphics)
{
   // fGraphics.drawText(fText, 0, 0);

   graphics.drawBitmap(0, 0, fBackground.getWidth(),  fBackground.getHeight(), fBackground, 0, 0);
   graphics.drawText(fText, 0, 0); // plus any other draws...
   super.paint(graphics);
}
}

Of course, you must also override sublayout() to this VerticalFieldManager to properly define its dimensions.

However, doing it this way is really strange. You must be something much simpler than a VerticalFieldManager to paint in it (expand, replace its layout() setExtent() correctly and his object to do any painting you need - do not call the super.paint (), it is abstract) or you add fields to it as usual and let the super.paint () do its job.

Tags: BlackBerry Developers

Similar Questions

  • How to clear the Jquery Autocomplete text.

    Hi all


    I've implemented a text using jquery AutoComplete element. Every thing seems fine, but when we have a clear of the country which State should be cleared.
    Here is the code, can any body hep me where and how to clear the values.
    --
    <script type="text/javascript">
    $( function() {
        
        $("#P16_ENG_CTRY").autocomplete({
            source : function( request , response) { 
                            data = getCountry(request.term);
                            response( data );
                     } ,
            focus  : function(event , ui){
                        event.preventDefault();
                     }
     
        });
    });
     
    function getCountry(key)
    { 
       document.getElementById('P16_ENG_CTRY')==''; 
       var ajaxRequest = new htmldb_Get( null , '&APP_ID.' , 'APPLICATION_PROCESS=GET_COUNTRY' , 0);
       ajaxRequest.add( 'G_MX01' , key);
       ajaxResult = ajaxRequest.get(); 
       
       return ((ajaxResult.length>0)? ajaxResult.split( '~' ):null);
     
    }
    
    
    $( function() {
        
        $("#P16_ENG_STATE").autocomplete({
            source : function( request , response) { 
                            data = getStateJ(request.term);
                            response( data );
                     } ,
            focus  : function(event , ui){
                        event.preventDefault();
                     }
     
        });
    });
     
    function getStateJ(key)
    { 
    
      
    document.getElementById('P16_ENG_STATE')=='';
          var ajaxRequest = new htmldb_Get( null , '&APP_ID.' , 'APPLICATION_PROCESS=GET_JSTATE' , 0);
    
              ajaxRequest.add('G_MX01',document.getElementById('P16_ENG_CTRY').value);        
              ajaxRequest.add( 'G_MX03' , key);
              ajaxResult = ajaxRequest.get(); 
       
       return ((ajaxResult.length>0)? ajaxResult.split( '~' ):null);
     
    }
    
    
    $( function() {
        
        $("#P16_ENG_CITY").autocomplete({
            source : function( request , response) { 
                            data = getCityJ(request.term);
                            response( data );
                     } ,
            focus  : function(event , ui){
                        event.preventDefault();
                     }
     
        });
    });
    Thank you
    David...

    Try this then and you can replace the blur with an event of jquery as you like

    $("#P16_ENG_CTRY").blur(function() {
    //clear the value
      if ($(this).val()==null || $(this).val()=="") {
         $("#P16_ENG_STATE").val('');
      }
     }
    });
    
  • Portege Z930 - how to clear the memory of the fingerprint sensor?

    Hello

    Tell me how to clear the memory of the fingerprint sensor?
    Reinstall the operating system and now I can not add your impressions.

    They have their No....

    > Reinstall the operating system and now I can not add your impressions.
    Stand by. You have reinstalled OS using original recovery image?

  • If anyone can help with how to get the image

    a database in a view using Dreamweaver page?

    I have a page with a recordset and a database with text and images. The image field has a link to the file and the image as in /images/image1.jpg including the size.

    The thumbnail I want to display on a page of the main display is in the database using varchar with a link like /images/image1.jpg

    When someone wants to see the master page, they click on a link and everything which has been entered showing the database. At least everything except the image.  Right now it shows just /images/image1.jpg

    I don't know how to call the images to the database.

    Thanks for the help and information.

    conch,

    Check the entry of the database, and you may also have too many tags...

    In addition, check to see if your pictures folder is in the root directory, such as an incorrect path can complicate things.

    If this site is located on a remote server, feel free to send me the link here or by e-mail: [email protected]

    In addition, if you have a screenshot, it would be useful.

    Hang on!

    See you soon,.

    wordman

  • How to clear the children containers?

    My little app is coming along, has managed to get this well with the excellent advice of those here. My last problem is that when I leave the area of detail and select a new (master1) I don't know how to clear the details of the previous selections (master 2). When I select of (master1) DataGrid (master 2) is poplulated, but the Image on the canvas is still the Image previously selected until I select a new on in (master 2). Is there anyway to dump on a new event (master1)? My attempt to define my layout is less. If it is not enough just let me know and I'll post everything that is necessary. Thanks again for all the previous Help and in advance for this one.

    Presentation of the step:

    mxDataGrid (master1)
    /mxDataGrid

    tabNavigator
    MX:canvas
    dataProvider {master1} MX:image
    /MX:canvas

    MX:canvas
    dataProvider {master1} MX:DataGrid
    MX:columns (master 2)
    /MX:DataGrid
    dataProvider {master2} MX:image
    /MX:canvas

    /MX:tabNavigator

    I just changed the 'visible' attribute instead of compensation on the value, and all is good. Thank you.

  • How to clear the hard drive on my old iMac of 2008?

    I have a 2008 iMac I want to recycle. How to clear the hard drive?

    (What is PPC?)

    PPC stands for Power PC. Is the name used to refer to the old Macs that uses a Motorola processor instead of Intel chips used today. To clear your old Mac follow the advice in this document from Apple... What to do before you sell or give away your Mac - Apple Support

  • How to clear the cache of firefox

    How to clear the cache of firefox

    Settings-Advanced below 'Network' and clear here

    https://support.Mozilla.org/ru/KB/Kak-ochistit-KESH-Firefox?redirectlocale=ru & redirectslug = Kak-ochistit-Kesh

  • How to clear the history?

    How to clear the history?

    https://support.Mozilla.org/en-us/KB/how-do-i-clear-private-data-Firefox-Android

  • Re: How to clear the model of Toshiba satellite PS271L - 6K 906 CMOS PASSWORD?

    In: Toshiba

    How to clear the model Toshiba Satellite PS271L - 6K 906 CMOS PASSWORD?
    Please respond to my E-mail [email protected]
    Thank you

    To: King

    http://forums.computers.Toshiba-Europe.com/forums/thread.jspa?MessageID=127837
    Read this thread very carefully!

  • How to clear the cache in 9.0.3

    Techno-bouffon here, in conflict on how to clear the cache in 9.0.3 (OS X 10.11.3 El Capitan). Some recommend to delete entire cache folder. Others say just clear com.apple.Safari, which I did. So... what happens if I delete the contents of the entire folder Caches? (I have nothing special set up on this computer.)

    Open Safari Preferences--> advanced.  Downstairs, make sure that ' see her develop menu in the menu bar "is checked.  Then go up to develop-> empty Caches.

  • How to disable the image previews

    In the windows client there is an option to disable the image previews with

    Tools-> Options-> settings IM-> Show advanced options. Uncheck the option: "show images in conversations".

    In the client Mac there isn't this option. How to disable the image previews in a Mac client?

    OK, found the solution in another thread here: http://community.skype.com/t5/Mac/YouTube-thumbnails-amp-link-previews-Why-don ' t-I-see-them/m-p/39692...

    Menu bar-> display-> display Images-> uncheck

  • How to clear the cmos on satellite p20 552 settings?

    How to clear the cmos on satellite p20 552 settings?

    Hello

    I guess you want to remove the BIOS password. Am I wrong?

  • How to clear the print queue on a printer hp x 6420

    How to clear the print queue on printer HP 4620?

    Hello

    From the desktop, hold down the Windows key and press R.  In the run window, type services.msc and press to enter.  Scroll down to the print spooler service, right click and select Properties, then click the Stop button.  Now search for C:\Windows\System32\Spool\PRINTERS, then delete the work inside this folder - you may need to click a command prompt to get the authority to open the PRINTERS folder.

    Restart the computer and you should find that the documents have been deleted.

    Kind regards

    DP - K

  • How to change the Image the Image (8 bit) (32 bit)?

    Dear all,

    I have a question about VISION.

    An Image from IMAQ USB Grab Acquire.vi is 32-bit, even if the IMAQ Creat.vi has the type U8 value.
    But the more IMAQ vi (for example IMAQ get LCD ROI.vi) can only deal with 8-bit Image.
    How to change the Image from 32-bit to 8-bit Image?
    Thank you!

    Hugo

    Hi Hugo,.

    You use a color camera? coz usually 32 bit for a color image.

    If so, you can try the unique color Pane.vi extract to extract its Luminance component. It then becomes an 8-bit grayscale image.

    Zheng OR AE

  • can someone tell me please how to clear the cache of adobe flash

    Hi can someone please tell me how to clear the cache of adobe flash? Please, I beg you. Thank you.  Tom.   for windows xp.

    Just click on clear all Web sites, and that's all!
    I hope this helps!
  • How to clear the table dhcp clients

    Does anyone know how to clear the Table of Clients DHCP?

    I have a WRV54G.

    Concerning

    I understand this is a very old post, but since I found it when I was looking for the same answer in 2009, I thought go ahead and give my $.02 worth.

    I have a different router, so it may not be present in your.

    I use a version of the firmware WRT54GLwith 4.30.7 and finally found on the status under "Local network" page a link to the DHCP table. You can click on that and delete existing IP addresses.

Maybe you are looking for

  • Last tab close Extionsion work differently

    Before update Firefox 13, the 'close last tab' Add we did what I wanted to do: he did not stop Firefox if I closed the last tab. He brought me to a page with a bunch of windows used previously. I don't want this functionality last restore tab. I just

  • Dano dominic

  • Get updates for Vista on a stand-alone computer

    My brother has a computer at home that is not connected to the internet.  Its operating system is VISTA Home Basic 32-bit.  The computer came with it and had no updates loaded to it.  Is there a way for me to download or to get all updates and servic

  • 6 batteries for x 201

    I'm moving from a cell of 4 to 6-cell for my x 201 laptop battery. don't stick 6-cell at the rear of the machine, and is there a choice? I don't know if the "slice" applies to my laptop. Thank you very much.

  • Enter Netwrking home network password problem

    I use a portable windows 7 family an emachines XP Edition and a hp Pavilion g7 and I started in network, but when you access files from my windows xp in my windows 7, he asks me a network password and I tried many things and don't work and it also wo