How to set a background image

HY guys, I'm trying to set a background image on a Blackberry screen. I used this code, but the image dousen can't cover the full screen. Can someone me say what the problem is, or give me an example of how's done it? package mypackage;

SerializableAttribute public class BackgroundImage extends UiApplication
{
Imagearriereplan private bitmap;
fieldBitmap private bitmap;
    
Public Shared Sub main (String [] args)
{
BackgroundImage PAP = new BackgroundImage();
theApp.enterEventDispatcher ();
}
    
public BackgroundImage()
{
The background image.
Imagearriereplan = Bitmap.getBitmapResource ("loginBackground.png");
        
Display display = new MainScreen();
        
HorizontalFieldManager horizontalFieldManager = HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | nouveau HorizontalFieldManager.USE_ALL_HEIGHT) {}
            
Override the paint method to draw the background image.
public void paint (Graphics graphics)
{
Draw the background image, then paint.
graphics.drawBitmap (0, 0, 240, 240, Imagearriereplan, 0, 0);
Super.Paint (Graphics);
}
            
};
        
The LabelField will be visible through the transparent image.
LabelField labelField is new LabelField ("is a label");.
        
A bitmap with a transparent image field.
The background image will be visible through the transparent BitMapField image.
BitmapField bitmapField = new BitmapField (Bitmap.getBitmapResource ("field.png"));

Add the handler to the screen.
mainScreen.add (horizontalFieldManager);
        
Add the fields to the Manager.
horizontalFieldManager.add (labelField);
horizontalFieldManager.add (bitmapField);
        
Tap on the screen.
pushScreen (mainScreen);
}
}

Thanks in advance

You can scale the image with EncodedImage, but it is usually best to use an image with a sufficient size

Tags: BlackBerry Developers

Similar Questions

  • How to set the background image in the window title?

    Hello

    I am a beginner in flex. I use Flex 4.

    Can someone give me some advice on how to set the background image in the title window?

    Is it possible to do?

    Thank you.

    Hello

    Check the code in the example below


    http://ns.Adobe.com/MXML/2009.
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" minWidth = "955" = "600" minHeight >
       
           
       

       
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/mx";

    s | {BorderContainer
    background - image: embed(source="image/wheres_the_green_rez.jpg");
    background-image-fill-mode: clip;
    }


       
           
       

    Kind regards

    Anitha

  • Cascades: How to set the background image for the menu drop down and etc...

    Hello

    Is there an easy way to set the background image for the menu drop down and etc, current support only black as a background?

    Thank you

    Tom.

    Welcome to the forums!

    This is currently not supported unfortunately.

    I encourage you to save a feature for this request:

    https://www.BlackBerry.com/JIRA/secure/dashboard.jspa

    See you soon!

    Martin

  • How to set the background image on my request.

    Hi all

    I use jdev 11.1.2.4.0 version

    use case: I create mobile applications and using the skin by default 'mobileFusionFx '.

    so when I run application there show black screen as a background image on my application

    My question is how to change the background image.

    Thank you

    Manish

    Resources of the Application open-> descriptors-> ADF META - INF-> adfmf-config. XML

    Check the family skin it and use in the skin of skin-addition id attribute.

    With this way automatically all your pages will use the same background image.

    In addition, background - image: url("images/back.png");    ---> It denotes that this images folder is inside the css file. If the pictures folder is a brother to css file, use

    background-image: url("..) (' / images/back.png ');

  • How to set a background image in javafx?

    Hello world

    I draw FXML GUI, it includes labels and ProgressBar, load it into JavaFX, it is a code snippet.

    root = FXMLLoader.load (getClass () .getResource ("StartMenuFXML.fxml"));

    Label1 = (label) root. Lookup ("#label");

    Label2 = (label) root. Lookup ("#label");

    progressBar = (ProgressBar) root.lookup ("#ProgressBar");

    scene = new Scene (root, 600, 400);

    stage.setTitle ('start progress");

    Progress p = new Progress();

    p.Start ();

    stage.setScene (scene);

    internship. Show();

    I need to add a background image, so I add the declarations:

    Component GridPane = new GridPane();

    pane.setTitle ("background - fx - image: url ('image1.jpg')");

    and change: scene = new Scene(pane,600,400);

    It can display the background image, but I don't know how to display tags and ProgressBar on the background image.

    Give me a good resolution, please!

    Thank you very much!

    Just do

    root.setStyle("-fx-background-image: url('image1.jpg')");
    

    and use your new Scene call (...) original.

  • How to set a background image re-scalable depending on the screen resolution of viewers

    Hello

    I searched the net for ages looking for a way to make a background image on the scale according to the size of a monitor of viewers.

    I found a solution:

    Source code

    < body >

    "< img src ="... /... ' / Images/Connor/background_bg.png ' class = 'bg' >

    < / body >

    CSS (style)

    {img.BG}

    / * Define the rules to fill the background * /.

    min-height: 100%;

    min-width: 1024px;

    / * Set up a proportional scaling * /.

    Width: 100%;

    height: auto;

    / * Set up positioning * /.

    position: fixed;

    top: 0;

    left: 0;

    }

    @media screen and (max-width: 1024px) {}

    {img.BG}

    left: 50%;

    left margin:-512px. }

    }

    Now, this has the desired effect, however when I place a div below "< img src ="... /... "' / Images/Connor/background_bg.png ' class = 'bg' > ' in the body of my site, it pushes this div below my bottom.

    I got the code from " " http://CSS-tricks.com/perfect-full-page-background-image/ "and it does not seem to do this in this example. "

    I pasted my complete code below, if someone could have a look and advise where I'm wrong that would be greatly appreciated.

    Thanks and greetings

    Elliot

    Source code

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""

    " < html xmlns =" http://www.w3.org/1999/xhtml ">

    < head >

    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"

    < title > Untitled Document < /title >

    < link href = "style.css" rel = "stylesheet" type = "text/css" / > "

    < script type = "text/javascript" >

    function MM_swapImgRestore() //v3.0 {}

    var i, x = offline. MM_sr; for (i = 0; a & & I <.) Length & & (x = a [i]) & & x.oSrc; i ++) x.src = x.oSrc;

    }

    function MM_preloadImages() {//v3.0

    var d = document; If (d.images) {if(!d.MM_p) d.MM_p = new Array();

    var i, j is d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i <.) Length; i ++)

    If (a [i].indexOf("#")! = 0) {d.MM_p [j] = new Image; d.MM_p [j ++] .src = a [i] ;}}

    }

    function MM_findObj (n, d) {//v4.01

    var p, i, x;  if(!d) d = document; If ((p = n.IndexOf ("?")) > 0 & & parent.frames.length) {}

    d = parent.frames [n.Substring(p+1)] .document; n = n.Substring (0, p) ;}

    If (!) () x = d [n]) & & copyrights) x = d.all [n]; for (i = 0;! x & & i < d.forms.length; i ++) x = d.forms [i] [n];

    for (i = 0;! x & & d.layers & & I < d.layers.length; i ++) x = MM_findObj (n, d.layers [i] .document);

    If (! x & & d.getElementById) x = d.getElementById (n); Return x;

    }

    function MM_swapImage() {//v3.0

    var i, j = 0, x, a = MM_swapImage.arguments; document. MM_sr = new Array; for (i = 0; i <(a.length-2); I += 3).

    If ((x = MM_findObj (a [i]))! = null) {document. MM_sr [j ++] = x; if(!x.oSrc) x.oSrc = x.src; x.SRC = a [i + 2] ;}

    }

    < /script >

    < / head >

    < onload of the body = MM_preloadImages('..) « /.. / Images/Connor/nav_bar/home_ro.png ','... /... / Av_bar/about_me_ro.png images/Connor/n ','... /... / Images/Connor/nav_bar/c.v_ro.png ','... /... / Bar/portfolio_ro.png images/Connor/nav_ ','... /... (/ Images/Connor/nav_bar/contact_me_ro.png') ">"

    "< img src ="... /... ' / Images/Connor/background_bg.png ' class = 'bg' >

    < div id = "web_centre_wrap" >

    < div id = 'menu_bar' > < table width = "960" border = "0" cellspacing = "0" cellpadding = "0" >

    < b >

    "< td width ="105"height ="68"> < img src ="... /... "/ Images/Connor/nav_bar/nav_bar_left.png" width = "105" height = "68" / > < table >

    "< td width ="147"height ="68"> < a href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage ('Image3 '", '... /..) " (/ Images/Connor/nav_bar/home_ro.png',1) "> < img src ="... /... "/ Images/Connor/nav_bar/home.png" name = "3" width = "147" height = "68" border = "0" id = "3" / > < /a > < table >

    "< td width ="147"height ="68"> < a href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage ('Image4 '", '... /..) " (/ Images/Connor/nav_bar/about_me_ro.png',1) "> < img src ="... /... "/ Images/Connor/nav_bar/about_me.png" name = "Image.4" width = "147" height = "68" border = "0" id = "Image.4" / > < /a > < table >

    "< td width ="148"height ="68"> < a href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage (' picture5 '", '... /..) " (/ Images/Connor/nav_bar/c.v_ro.png',1) "> < img src ="... /... "/ Images/Connor/nav_bar/c.v.png" name = "Picture5" width = "148" height = "68" border = "0" id = "Picture5" / > < /a > < table >

    "< td width ="147"height ="68"> < a href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage ('Image6 '", '... /..) " (/ Images/Connor/nav_bar/portfolio_ro.png',1) "> < img src ="... /... "/ Images/Connor/nav_bar/portfolio.png" name = "Image6" width = "147" height = "68" border = "0" id = "Image6" / > < /a > < table >

    "< td width ="148"height ="68"> < a href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage ('Image7 '", '..) " /.. (/ Images/Connor/nav_bar/contact_me_ro.png',1) "> < img src ="... /... "/ Images/Connor/nav_bar/contact_me.png" name = "Image7" width = "148" height = "68" border = "0" id = "Image7" / > < /a > < table >

    "< td width ="118"height ="68"> < img src ="... /... "/ Images/Connor/nav_bar/nav_bar_right.png" width = "118" height = "68" / > < table >

    < /tr >

    < /table >

    < / div >

    < div id = "header" > < / div >

    < div id = "content" > < / div >

    < div id = "footer" > < / div >

    < / div >

    < / body >

    < / html >

    CSS (style)

    @charset "utf-8";

    / * CSS document * /.

    {img.BG}

    min-height: 100%;

    min-width: 1024px;

    Width: 100%;

    height: auto;

    position: fixed;

    top: 0;

    left: 0 ;}

    @media screen and (max-width: 1024px) {}

    {img.BG}

    left: 50%;

    left margin:-512px ;}

    {#web_centre_wrap}

    Auto margin: 0 ;}

    {#menu_bar}

    #header {}

    Background: url (.. /.. Images/Connor/Header.png) ;}

    #content {}

    Background: url (.. /.. Images/Connor/content.png) ;}

    #footer {}

    Background: url (.. /.. Images/Connor/footer.png) ;}

    Try this:

    http://ALT-Web.com/test/resizable-BG.shtml

    Nancy O.

    ALT-Web Design & Publishing

    Web | Graphics | Print | Media specialists

    http://ALT-Web.com/


  • How to set the background image in the TextField in Cascade (Custom Field)?

    Hello

    Someone know how setBackGround image in TextField?

    As it actually:

    import bb.cascades 1.2
    NavigationPane {
        id: nav
    
        Page {
    
            Container {
    
                Container {
                    layout: DockLayout {
    
                    }
                    ImageView {
                        imageSource: "asset:///images/chicken.png"
                    }
                    TextField {
                        id: txt
                        text: "Hello"
                        backgroundVisible: false
                        verticalAlignment: VerticalAlignment.Center
                        textStyle.fontSize: FontSize.Large
                    }
                }
            }
        }
    }
    

  • How to set the background picture to static?

    I want my background image to be static, so the background image does not move when I scroll the vertical field Manager. no idea how this is possible?

    UPS... my bad

    I can solve it...

    to set the background image on full screen

    and the setextend field to see the height of the value

  • 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 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 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

  • Is it possible to set the background Image of the graph?

    APEX version: 4.2.3

    Browser: IE9 / Chrome

    DB: Oracle 11 g 2

    Hello Experts,

    It is possible the background image of the cards? If so, please guide me how to do because I have found no option.

    Thank you!

    Is something like what you had in mind?

    http://Apex.Oracle.com/pls/Apex/f?p=76573:1

    This was accomplished by customizing the fill setting in the XML behind the Anychart.

    Background of the chart has been

    
     
     
     
     
    

    Altered see line 2:

    
     
     
     
     
    

    Jeff

  • How to make the background image for a site

    Hello.

    First of all, thank you for reading this.

    I intend using a gradient image as background on a new site of black on the sides gradiating to blue in the Middle I created in Photoshop. The site is designed for 1024 (955) and upward. How the background image would handle so that no matter what the resolution above 1024, the visitor sees the gradient correctly, which means that Blue will be always exactly in the center of the page and the image not horizontal mosaic? (I don't want to repeat from left to right when the resolution someone is really high)

    I saw a couple of sites that use strong images that seem to stretch the background image according to the resolution, but were not able to understand the CSS code. In my case, I have a single image that has say 5 pixels high, how wide I need for the (reasonable) maximum resolution, and let repeat from top to bottom.

    Thank you.

    MFitz721

    To do what you ask would require CSS3.  This is because that the CSS3 added support for multiple background images.  What you would do, is to set a gradient to the left and the other to the right with a background color that arise in a vacuum.    Basically use you the abbreviation of "substance" and separate the different environments with a comma ","  See this example ( http://www.css3.info/preview/multiple-backgrounds/ ).  I think it's possible the long way as well (for example: position of background, background image, etc.), but you would need to write the values and who is 1 and 2 in order when you do this.

  • How to stretch the background image in the body in relation to the browser instead of the default repeat?

    Hello world

    I am new to dreamweaver and I'm still learning the basics. What I'm trying to accomplish at present:

    I have a #container div in my body div.  The container is set to the auto margins in the body so that it is always centered.  I want a background image in the body (behind the container div), BUT I do not want to repeat awkwardly.  I want so that it can automatically expand to the size of the browser of the Viewer.  How can I do this? Anyone know?

    Thank you very much :)

    Murray * CPA * has written:

    Now - background images DO NOT STRETCH.  So much for that idea...

    This was true when Murray originally wrote in April 2009, but shortly after, it became possible using the CSS3 background-size property, which is now supported by most browsers. See http://cookbooks.adobe.com/post_CSS_Background_Stretch__updated_-16474.html.

    It is the risk of a diversion of a thread that has more than three years. Other people could come along and do not realize that boards of formerly right of Murray is now obsolete.

    I am locking this thread to avoid the wrong information to perpetuate.

  • Set the background image of a cluster? [LV 2013]

    Hello-

    Researcher, said, "why don" t you turn the image on the front panel and then decorate the image with the controls? See? Problem solved. "And the door closes.

    So, I take the picture, scaling properly and voila! It is now the background image.  Then add controls.

    The horizontal and vertical scroll bars to move controls... but the background image is not followed.  So if someone touches the scroll bars (they are required) then controls and image are aligned.  Worse yet, their modified track manually is a pain in the eye-hand control.

    I could put in a button titled "realign" and have it reset the position of the scroll bar. Or have the scrolling screen VI bar position (look at the FP zero spot) and some treatment to shift the image of the picture.  What is its painful.  Is there another way around the problem?

    HM. A cluster? Clusters follow the scroll bars. But I can't seem to put a background image a cluster. The background color can be changed... but I don't see a way to paste a picture.  I tried customizing the cluster control and attempted to use the same method to add an image as on the front panel (with the right button of the scroll bar, follow the instructions). This has changed the background of the typedef would control.  Saved.  Tried to use it. LabVIEW will > BEEP<  and="" nothing="">

    I really want to avoid building this complex picture of decorations.  Especially when the image has chemical compounds in the boxes: how to index and the letters and numbers?   That... and the image is one of these steps 'it's refinement... ».

    Thank you for your time.

    Mark

    You don't give enough information on how this actually looks like and I don't have any experience with background images, but I would simply say, you drag the image file in the public Service and use the command menu in the toolbar to move backward (Ctrl + Shift + J) and then it must maintain position relative to other objects. You can then use the same menu to lock, so that it is not moved accidentally. You can also place an image control in the back and load the image in the code if it changes a lot, but this isn't a recipe for positioning the elements properly.

    I also generally agree with Martins that scrolling is a flag. If you need to scroll, you look and see if there is a problem and other solutions.

Maybe you are looking for