Background problem domain image.

Hi, I'm trying to put a background image to my application but when I do this the first time (just started) I will work perfectly but when I select a field and he lost focus background don't repaint. It's my source code:

//this is where i go to put the button

VerticalFieldManager panel= new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH |VerticalFieldManager.USE_ALL_HEIGHT)        {            protected void paint(Graphics graphics)            {                try                {                    graphics.drawBitmap(0, 0, graphics.getScreenWidth(), graphics.getScreenHeight(),                            ComunicadorCore.getGestorImagenes().getImagen("fondo.png").getBitmap(), 0, 0);                }                catch (ImagenException e)                {                    // TODO Auto-generated catch block                    e.printStackTrace();                }                super.paint(graphics);            }        };

////////////////////////////////////////////////////////////////////

It's the key

public class BotonContactos extends Field implements DrawStyle{    private boolean focus=false;   

    private Font fuente;    private int anchuraLabels;

    private int margenAnchura=10;    private int margenAltura=2;

    private String labelNombre;    private XYRect posLabelNombre;

    private String labelEstado;    private XYRect posLabelEstado;

    private EncodedImage imagenEstado;    private Bitmap bitMapEstado;    private XYRect posImagenEstado;

    private EncodedImage imagenFormaContacto;    private XYRect posImagenFormaContacto;    private Bitmap bitMapFormaContacto;

    private int anchuraBoton;    private int alturaBoton;

    //formato del color 0x00RRGGBB    private final static int COLOR_FONDO_FOCO=0x008CAFDC;

    private final static int COLOR_LETRAS_FOCO=0x00000066;

    private final static int COLOR_LETRAS_NO_FOCO=0x00F0F4F9;

    //Transparecia seleccion

    private final static int TRANSPARECIA_SELECCION_FOCO=80;

    public BotonContactos()    {        super(Field.FOCUSABLE);               posLabelNombre=new XYRect();        posLabelEstado=new XYRect();        posImagenEstado=new XYRect();        posImagenFormaContacto=new XYRect();    }

    protected void drawFocus(Graphics graphics, boolean on)    {        MensajesLog.debug(BotonContactos.class, "Dibujo el foco: "+this.getLabelNombre());        this.focus=true;               super.drawFocus(graphics, false);    }       

    public int getPreferredWidth()    {        int tam=0;        if(this.imagenEstado!=null&&this.imagenFormaContacto!=null)        {            //Ponemos el margen de la izquierda            tam+=margenAnchura;

            //Ponemos el tamaño de la imagen de estado            tam+=imagenEstado.getWidth();

            //Ponemos el tamaño de la imagen de forma de contacto            tam+=imagenFormaContacto.getWidth();

            //Ponemos el margen entre las imagenes y los labels            tam+=margenAnchura;

            //Ponemos el tamaño de los labels            MensajesLog.debug(BotonContactos.class, "El tamaño del contenedor es: "+this.getContentRect().width);            //TODO coger el tamaño del boton            anchuraLabels=anchuraBoton-tam-margenAnchura;                       if(anchuraLabels>0)            {                tam+=anchuraLabels;            }            else            {                anchuraLabels=0;            }

            //Ponemos el margen de la derecha            tam+=margenAnchura;        }        MensajesLog.debug(BotonContactos.class, "La anchura del boton es: "+tam);               return tam;    }

    public int getPreferredHeight()    {        int tam=0;        if(this.imagenEstado!=null&&this.imagenFormaContacto!=null)        {            tam=imagenEstado.getHeight();            int tamFont=this.getFont().getHeight();            //multiplicamos por 2            tamFont=tamFont<<1;            if(tam>1);        MensajesLog.debug(BotonContactos.class, "La altura del boton es: "+tam);        return tam;    }

    /**     * Metodo que calcula la posicion de los componentes dentro     * del boton     */    protected void layout(int width, int height)    {        // Calculate width.        anchuraBoton =  width;        anchuraBoton = Math.min( anchuraBoton, getPreferredWidth() );        MensajesLog.debug(BotonContactos.class, "La anchuraBoton del boton es: "+width);        // Calculate height.        alturaBoton = Math.min( height, getPreferredHeight() );        MensajesLog.debug(BotonContactos.class, "La alturaBoton del boton es: "+height);

        fuente=getFont();               if(this.imagenEstado!=null&&this.imagenFormaContacto!=null)        {            int posYEstado=calculoPosicionAlturaImagenes(imagenEstado);            this.posImagenEstado.setLocation(this.margenAnchura,posYEstado);            this.posImagenEstado.setSize(this.imagenEstado.getWidth(), this.imagenEstado.getHeight());

            int posYFormaContacto=calculoPosicionAlturaImagenes(imagenFormaContacto);            int posXFormaContacto=this.posImagenEstado.x+imagenEstado.getWidth();            this.posImagenFormaContacto.setLocation(posXFormaContacto, posYFormaContacto);            this.posImagenFormaContacto.setSize(this.imagenFormaContacto.getWidth(), this.imagenFormaContacto.getHeight());

            int posXCabecera=this.posImagenFormaContacto.x+imagenFormaContacto.getWidth()+this.margenAnchura;            int posYCabecera=this.margenAltura;            this.posLabelNombre.setLocation(posXCabecera, posYCabecera);

            int posXCuerpo=this.posLabelNombre.x;            int espacioEntreLabels=fuente.getHeight()>>1;            espacioEntreLabels+=fuente.getHeight();            int posYCuerpo=this.posLabelNombre.y+espacioEntreLabels;            this.posLabelEstado.setLocation(posXCuerpo,posYCuerpo);        }               setExtent( anchuraBoton, alturaBoton );           }

    /**     * Calcula la posicon y centrada de la imagen dentro del boton     * @param image     * @return     */    private int calculoPosicionAlturaImagenes(EncodedImage image)    {        int posY=0;        if(image!=null)        {            int alturaImage=image.getHeight();            int margen=this.getPreferredHeight()-alturaImage;            if(margen>0)            {                posY=margen>>1;            }        }        return posY;    }

    /**     * Metodo que pinta el Boton     */    protected void paint(Graphics graphics)    {

        if(this.imagenEstado!=null&&this.imagenFormaContacto!=null)        {                               graphics.setFont(fuente);            if(this.focus)            {                   //Dibujo el recuadro de seleccion                graphics.setColor(COLOR_FONDO_FOCO);                graphics.setGlobalAlpha(TRANSPARECIA_SELECCION_FOCO);                graphics.fillRoundRect(0, 0, this.anchuraBoton, this.alturaBoton, 20, 20);

                //Pongo la configuracion para escribir el texto                graphics.setGlobalAlpha(255);                graphics.setColor(COLOR_LETRAS_FOCO);            }            else            {                graphics.setColor(COLOR_LETRAS_NO_FOCO);            }            MensajesLog.debug(BotonContactos.class, "Comienzo a pintar");            graphics.drawBitmap(this.posImagenEstado, this.bitMapEstado, 0, 0);            graphics.drawBitmap(this.posImagenFormaContacto, this.bitMapFormaContacto, 0, 0);            graphics.drawText(this.labelNombre, this.posLabelNombre.x, this.posLabelNombre.y);                                   graphics.drawText(this.labelEstado, this.posLabelEstado.x, this.posLabelEstado.y);            this.focus=false;

        }

    }

    /**     * Metodo para leer el nombre del contacto que muestra el boton     * @return     */    public String getLabelNombre()    {        return labelNombre;    }

    /**     * Metodo para asignar el nombre del contacto al boton     * @param nombre     */    public void setLabelNombre(String nombre)    {        this.labelNombre = nombre;        updateLayout();    }

    /**     * Metodo para leer el estado del contacto que muestra el boton     * @return     */    public String getLabelEstado()    {        return labelEstado;           }

    /**     * Metodo para asignar el estado del contacto al boton     * @param estado     */    public void setLabelEstado(String estado)    {        this.labelEstado = estado;        updateLayout();    }

    /**     * Metodo que devuelve la imagen del estado     * @return     */    public EncodedImage getImagenEstado()    {        return imagenEstado;    }

    /**     * Metodo que asigna la imagen del estado     * @param imagenEstado     */    public void setImagenEstado(EncodedImage imagenEstado)    {        if(imagenEstado!=null)        {            this.imagenEstado = imagenEstado;            bitMapEstado=this.imagenEstado.getBitmap();            updateLayout();        }    }

    /**     * Metodo que devuelve la imagen de la forma de contacto     * @return     */    public EncodedImage getImagenFormaContacto()    {        return imagenFormaContacto;    }

    /**     * Metodo que asigna la imagen de la forma de contacto     * @param imagenFormaContacto     */    public void setImagenFormaContacto(EncodedImage imagenFormaContacto)    {           if(imagenFormaContacto!=null)        {            this.imagenFormaContacto = imagenFormaContacto;            this.bitMapFormaContacto=this.imagenFormaContacto.getBitmap();            updateLayout();        }    }

    protected void onFocus(int i) {        // TODO Auto-generated method stub        this.focus=true;

        super.onFocus(i);    }

    protected void onUnfocus() {        // TODO Auto-generated method stub        this.focus=false;        super.onUnfocus();    }

I found the solution.

VerticalFieldManager panel= new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH |VerticalFieldManager.USE_ALL_HEIGHT)       {         /*            protected void paint(Graphics graphics)           {             try               {                 graphics.drawBitmap(0, 0, graphics.getScreenWidth(), graphics.getScreenHeight(),                          ComunicadorCore.getGestorImagenes().getImagen("fondo.png").getBitmap(), 0, 0);                }             catch (ImagenException e)                 {                 // TODO Auto-generated catch block                    e.printStackTrace();              }             super.paint(graphics);            }         */            protected void paintBackground(Graphics graphics)             {             try               {                 graphics.drawBitmap(0, 0, graphics.getScreenWidth(), graphics.getScreenHeight(),                          ComunicadorCore.getGestorImagenes().getImagen("fondo.png").getBitmap(), 0, 0);                }             catch (ImagenException e)                 {                 // TODO Auto-generated catch block                    e.printStackTrace();              }             super.paintBackground(graphics);          }     };

Tags: BlackBerry Developers

Similar Questions

  • Last night suddenly when I right click view image in firefox, they appear centered and on a black background. He is generally meant to be a white background and the image that appears at the top left. How to get back to it?

    I have a problem with something in firefox, it is quite minor, but still bothers me. Last night suddenly when I right click view image in firefox, they appear centered and on a black background. He is generally meant to be a white background and the image that appears at the top left. I don't remember what I did to change this if it's my fault; If anyone knows how to get back to it, I would be grateful.

    This is the new behavior in Firefox 11.

    See also:

  • How to remove the background of the image?

    Hello

    I do a simple programming using Labview 2009. May I know someone at - he no how do I remove the background of the image?  Programming is using camera. First of all, it shows the image... then the threshold in white black... then when the "wanted" image detected it will save the image... but my problem is the image cannot be analysis because of the background is green... so, I want only the object... FYI, the user that the image in RGB and the user only has the bottom to be black but the conveyor is green... we do want to not change the conveyer with the expensive sensor and use.

    You can do a checkout from plan color and then apply threshold on a grayscale image. What is the color of the object? Can you put a picture so that I can work on it?

  • trying to match the background of the image sidebar

    I'm creating a professional portfolio.  I worked on this problem for days and nothing I try seems to work.  It's a little hard to explain so I'm posting a page in order to help this discussion.

    print screen.jpg

    How can I get the background of my image to match the sidebar of my illustrator file?  Tried to select background, then paint of the same color.  But the colors do not match.  I have to make a transparent background somehow?

    Is your background image REALLY 50 %K or is it a generation of CMYK for trying to look like 50 %k?

    If you hover over the background in Photoshop which is read the Info Panel? Is there the CMY values in the info panel? This isn't a 50 %K then.

    If you want 50% K in Photoshop, you must add 50% to the K channel in Photoshop and not simply paint over 50 %k.

  • Need to activate printing background colors and images, but this is not where it should be in the options/tools/int adv tab. Any ideas?

    need to activate printing background colors and images, but this is not where it should be in the options/tools/int adv tab. Any ideas?

    Try the following. Open IE11, click on the tools, mouse over the option 'Print' option and select "print preview

    Select the layout, as shown below.

    Place a check in the "case print the background color and images.

    Click on the OK"" button.

    J W Stuart: http://www.pagestart.com

  • Remove the white background of an image

    Hi guys!

    Often when you use the magic wand tool, it's a good job remove the white background on an image...

    Is there a way to calm the whitish glow that remains even after the removal of the background...

    If I add a background color of the test, it shows a whitish glow around the image...

    bookie56

    Hi bookmaker.

    Please follow the below items.

    Fix the tone and color with levels in Photoshop

    Using Photoshop | Adjust the tone and color of the image

    Hope that helps

    Kind regards

    Mohit

  • How to eliminate the background of an image while now semi transparent medium ground.

    Sorry if the topic name is slightly inaccurate, or if my question seems amaturish, I am relatively new to the use of Psalm for a project, I want to remove the black background of this image http://calibermag.org/wp-content/uploads/2013/11/2534069-Action-Bronson-617.jpg and replace it with a different background, however I would like to keep the smoke that is dwell on the bottom. Are there techniques or tools that I could use to remove the background and black behind the smoke without directly to smoke?

    This image will respond well to the function [refine edge].

    Basically, select the guy with for example, the tool to quickly select, then use refine edge and paint the RADIUS tool to refine by smoke.

    This tutorial gives the technique in detail.  The technique illustrated works in the latest version of Photoshop.

    http://TV.Adobe.com/watch/the-Russell-Brown-show/masking-basics-in-Photoshop-CS5/

    Smoke isn't too terribly different from the conceptual point of view, that hair.

    -Christmas

  • How can I change the background of an image?

    How can I change the background of an image?

    https://www.Google.co.UK/search?q=background+removal+in+Photoshop&OQ=background+removal+in + & aqs = chrome. 1.69i57j0l5.13265j0j8 & sourceid = chrome & espv = 210 & es_sm = 122 & ie = UTF - 8

    A good starting point.

    There are many and varied ways to remove the background from using the background Eraser, creating masks, layer, then the use of the channels.

    It is a big topic, but Google is your friend (the other search engines are available)

    Have fun working through it all.

    See you soon

    John

  • Q: How do hide you a background of an image

    How delete/do transperant or even hide a background to an image in flash? for example:-you have a photo of a bird in the sky, how only the visible bird & the invisible sky using flash? is there a way?

    or should it be accomplished in another program and saved in a specific file & then impotred in flash? If Yes, what kind of file should the image be saved as?

    Also... If you were to place the image of the bird in the sky on another image (in flash), the goal is not to see the bird and the background image.

    help appreciated!

    David

    Sydney, Australia.

    Okey...

    The only thing I left out is that you must manually remove the background in Photoshop... so that it is transparent before exporting the image to the web via "save for web".

    Otherwise, there is no transparency in the image for see-through.

    Bob

  • A problem with Images of great CSS background

    I have two images of great background, placed at the bottom of the page. The problem with the help of the bottom property to position a picture is that browsers that don't have much height will cut upper part of the image (in my case, Santa). Here is the link:

    http://www.holidaymarket2010.com/

    By reducing the height of your browser, you can see what I mean. The image starts at the bottom of the page, so if the screen is not high enough the upper part of the image will be cut off.

    The image must be position at the bottom because the Christmas tree (piled up like a Christmas tree bulbs) is cut down. The background looks fine in most browsers, but there are many portable large screen that have less height than most of the other screens.

    Ideally, I'd like the image to start at the top of the page, as if I had used the top property position my images. So, there's the dilemma. I wonder if anyone knows of the tips of how I could pull this off. In other words, I want to position the image at the bottom of the page, but I want the lower part to be cut, not from the top, if the screen does not have enough height to display the entire image. Any ideas?

    How about you decide your BG image in two separate images, configure a container for each, and you can then position Santa on top.

  • CSS code for the background of the image problem fixed

    Hello world
    I struggled for almost 2 days on and outside to try to understand why I can't get the codes for a fixed background work properly. I'll copy the code here directly and hope that someone can see what the problem is. I also give a link to the site I'm just starting to be implemented.
    http://seanshaw.NET So you can see the source code here... Any help would be greatly appreciated as I have tried 3 different versions of the code fixed background and none of them does not work for me. What Miss me? :)

    Thanks for any help on this problem... Best regards, Jo Whimzicals.com

    The code that I currently use is this one... I take you from the top to the body tag:

    <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional / / IN".
    " http://www.w3.org/TR/html4/loose.dtd" >
    < html >
    < head >
    < style type = "text/css" >
    body
    {
    background-image:
    URL ('BckgndHome.gif');
    background-repeat:
    no-repeat;
    background-attachment:
    fixed
    }
    < / style >
    < title > Sean Shaw Art, Art of Sean Shaw < /title >
    < meta http-equiv = "Content-Type" content = text/html"; charset = iso-8859-1 ">"
    < style type = "text/css" >
    <!--
    body, td, th {}
    do-family: Verdana, Arial, Helvetica, without serif.
    }
    {body
    background-image: url(Home/BckgndHome.gif);
    }
    {.style2}
    do-size: 18px;
    color: #FFFFFF;
    }
    .style3 {color: #FFFFFF}
    ->
    < / style > < / head >

    < body >
    ==============================
    Just to clarify things, I also tried these two codes, that makes perfect sense to me, but they still do not work for me.
    ==============================
    < style type = "text/css" >
    Body {background: url (fixedbg.gif) set of Center no-repeat ;}}
    < / style >
    =======================
    ... and this one...

    < html >
    < head >

    < style type = "text/css" >
    body
    {
    background-image:
    URL ('image.gif')
    }
    < / style >

    < / head >

    < body >
    < / body >

    < / html >

    Ahhhhhhhh, Thank you VERY MUCH, ACE! I found and removed the second command line, and you were quite right... the bottom now remains in place and works perfectly. Thank you for taking the time to help me... Awesome. Have an awesome Sunday... Best regards, Jo :)))

  • Icons of Windows/folder/images virgins; can not change the background in the image.

    Thus,.

    I don't know what happened, but I had somehow the virus/trojan thingy goingonearth.com... I don't even know if it has nothing to do with my problem. I know that since discover and try to remove the virus/trojan said, I experienced a few problems:
    1. my file & image icons (tiles) were literally emptied in large mode. But there is NO icon file (photo). The text/image folder is still there. The REAL folder icon shows when using small icons, but if I switch to large icons, it extends a smaller and makes VERY pixelated (sp?) (photo). In any case, I have inserted screen captures.

    2. When you delete a file, I noticed the associated picture icon is black (photo).

    3. I can't change my desktop image using the photos, I can however change the solid color black color I want OR I can use a canvas photo and set it as my desktop. The icons below the screen background images is empty as well (photo).

    I can assure you that I unchecked the "always show icons, never thumbnails" option in the Folder Options under control panel (photo).

    ANY help would be appreciated, it drives me crazy.

    Thank you
    Cuzimjustmeh

    I never found a solution to this problem. I've just upgraded from Vista to Windows 8 and everything is fixed. Clearly.

    JustMeh

  • Video in the background of the image

    I'm having problems trying to have a video as a background with a background image behind it (so you have the image if video does not load). When I place the image layer in the back, for some reason any it pushes even forward above the video layer (even if the video layer is longer up).

    Thanks for the construction of this demo. Actually much clearer to avoid misunderstandings.

    I think the name says it all: "fullscreen video background" . He undertakes at its lowest, regardless the layering or stacking order.

    Some "gross coding" would be able to set the static image as a true image of retrenchment for videos, but she would need to modified code of the Muse and tweaking it whenever you update the Web site. I just remove the current image and make sure to compress the file video (s), so it loads quickly. Miro Converter allows you to set a screen size moderate for three formats (video in a context has no need to be high resolution) and keep your fingers crossed when your customer opens a slow mobile connection...

  • How to remove a background from an image with a body similar to the background color

    Hello world!

    New here so I hope I ask this in the right place

    I used to use photoshop many years ago and get back inside. One thing with which I have a particular problem delimbing Fund images that are quite bright whites / have little white in them - normally I would use techniques basic as the background eraser or the magic wand, but due to the edges by a quite brilliant and mix a little in the back on the ground, I find it very difficult to cut the image.

    I work with an example image is this yo-yo > http://yoyovillage.co.uk/img/c/iYoYo%20Steel_1200px_01.jpg

    Basically, I want to remove the white background and also the reflection / shadow below while I'm just left with the body of yo-yo in the image (like this > http://www.yoyovillage.co.uk/264-home_default/level-6.jpg)

    One option, I was advised might work using a layer mask shape and essentially make a copy of the image in photoshop layer and then use the settings of brightness/contrast to ensure that the yo-yo is a little more easily selectable, but this does not work either (and I'm a bit of a n00b when it comes to layer masks).

    I was hoping someone here might be able to help - it may be that it's just not possible, but if anyone can say anything I would really appreciate it.

    Thank you very much

    Luke

    Took about 3 minutes:

  • Problem of Image Slideshow plugin title Spry

    The titles of my slide show as each image change is not updated. The title is currently remains the same, when I want to change with each photo. What is the problem with the plugin code title of this widget?

    I want the title of the first photo to say "College Avenue residence front" link: College Avenue Residence

    I was once edit an Excel spreadsheet when I was called away. When I returned, all the cells are empty. In my panic, I did not know that the formula bar always contained the information. Much later and with the help of a colleague, I changed the font back to black color and everything was fine.

    I think a font color of #333333 on a background color of #333333 has much the same effect as white on white. Take a look at the #168 of your document line.

Maybe you are looking for

  • How can I run the Windows 8.1 Profile Manager

    I have three laptop computers, both running windows 7 and one running windows 8.1 I just put up a few proifles on a Windows 7 machine and also started using Sync. I went to Windows 8.1 machine to test my work. Sync works fine, I now all my old favori

  • Plan of iCloud upgrade at the end of this month?

    I put my iCloud plan to 200G, but today is May 24. How Apple charge me? There's only 6 days in may, I will be charged a monthly rate together?

  • reset question and encryption Time capsule

    I have reset my Time Capsule with a hard reset (power off and the reset button on TC).  I've reset with the same password but do not know if my TC drive is always encrypted with the same password as before the hard reset. I lost control of my time Ca

  • Admin or power on the HP Envy Beats edition, model 6-1019tx pass

    tried to reset the laptop, obviously done something wrong, now I'm locked out

  • The disk on the Satellite A60 boot problem

    I have a Satellite A60, I thought that the HARD drive was not on. When you turn on the machine, it goes beyond the POST screen and starts with the startup of Windows XP, I get the blue bars moving and the XP logo then IT just freezes. Replaced the HA