Image will not display in a jFrame

So, I had this working, but then I resized the jFrame and the image, and now it doesn't work. I even tried setting it back to the original size and it still doesn't work. I changed nothing else in the code.
I'm using Netbeans IDE and this is a java desktop application so maybe it changed something without telling me. Any advice would be appreciated.
ImageIcon bgmap = new ImageIcon("C:\\Users\\1\\Documents\\NetBeansProjects\\Timekeeper\\src\\timekeeper\\resources\\Sunlight.png");
Image i = bgmap.getImage();
ImageObserver Iob = null;
//Al.setBackground(Color.black);
//Al.setForeground(Color.black);
jPanel3.getGraphics().drawImage(i, 0, 0, Iob);
jPanel3.getGraphics().setPaintMode();

pbrockway2 wrote:
Make sure the image i is not null. Paint in a component's paintComponent() method (and unless there is some reason for doing so, don't keep recreating the image.)Added to that:
1) If you mean JFrame, spell it correctly (with correct capitalisation) so we can be sure you are dealing with a JFrame as opposed to some 3rd party class that nobody here knows about, nor supports.
2)
ImageIcon bgmap = new ImageIcon("C:\\Users\\1\\Documents\\NetBeansProjects\\Timekeeper\\src\\timekeeper\\resources\\Sunlight.png");
Image i = bgmap.getImage();
ImageObserver Iob = null;
//Al.setBackground(Color.black);
//Al.setForeground(Color.black);
jPanel3.getGraphics().drawImage(i, 0, 0, Iob);
jPanel3.getGraphics().setPaintMode();How can you jam so much crap into so few lines?
a) Try not to post code with lines that are commented out. That is just a waste of bandwidth.
b) Declaring an ImageObserver and setting it to null before passing the null variable to the drawImage() method is a waste of a line, since you could directly pass 'null'. But..
c) JPanels as well as many other components, implement an ImageObserver, so why the heck not pass the JPanel is ImageObserver, rather than 'null'?
d) If you do not pass an image to something that is an ImageObserver, ensure it is loaded by using a MediaTracker.
e) Never call getGraphics().
f) Your call to setPaintMode() at the end of the lines. What did you expect that to do? Did you read the JavaDocs for the method, or did you just throw it in there for 'good luck'?
In future, please consider posting code in the form of an SSCCE. For image based SSCCEs, you can hot-link to any of the [images at my site|http://pscode.org/media/#image].

Similar Messages

  • Banner image will not display in Dreamweaver; can you help?

    Banner image will not display in Dreamweaver; can you help?

    If the banner image is not displaying, it is either not in an acceptable web file format (optimized for web as jpg, gif or png). Or it is corrupted.  Or the path to the image file on server is broken. 
    It's impossible to say more without a link to your problem page.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • Newly created images will not display in Firefox 8 for Mac. Same images appear in other browsers. Why?

    1. Specific new images are uploaded but will not display in Firefox 8 on my Mac with OS 10.6.8. (Does appear in other browsers, e.g., Chrome and Opera, and appears on Firefox 8 for PC.) Also, other images on the page display.
    2. I have cleared cache, cookies, etc., in Recent History, and restarted both application and computer.
    3. I've tried creating GIF, JPG and PNG, but none show on the page in Firefox on my Mac. I can see the offending image in other browsers such as Chrome on the same computer, and on Firefox on PC. Offending pages are in both PHP and HTML: http://www.brookfieldcivic.org/advertisers.php and http://www.brookfieldcivic.org/advertising_freedom_montessori.html
    Image links: http://www.brookfieldcivic.org/images/advertisers/freedom.png and http://www.brookfieldcivic.org/images/advertisers/Freedom_Montessori_bizcard.jpg

    You can use these steps to check if images are blocked:
    *Open the web page that has the images missing in a browser tab.
    *Click the website favicon ([[Site Identity Button]]) on the left end of the location bar.
    *Click the "More Information" button to open the "Page Info" window with the Security tab selected (also accessible via "Tools > Page Info").
    *Go to the <i>Media</i> tab of the "Tools > Page Info" window.
    *Select the first image link and scroll down through the list with the Down arrow key.
    *If an image in the list is grayed and there is a check-mark in the box "<i>Block Images from...</i>" then remove that mark to unblock the images from that domain.

  • Images will not display, please help

    Hi,
    I have built a couple of sites, one with tables one CSS where
    my banners will not display on my screen when I view the site
    online. The sites are:
    www.gnewt.co.uk &
    www.getouthavefun.co.uk
    The banners are visible on some other computers online, but
    not all and the images display fine when i preview the site not
    online but in Firefox or IE. I have tracked the problem down to
    this, online when I right click where the image should be
    displaying it says the filename etc and for dimensions says:
    Image Dimensions: 1px × 1px (scaled to 950px ×
    120px)
    Size of File: 0.04 kB (43 bytes)
    I can right click and download the image to my desktop from
    the ftp and it will display fine, so it must be an html problem. I
    have been using templates and have uploaded a version not attached
    to a template and that makes no difference, I have also tried
    differing filetypes such as gif and png, again no change.
    Furthermore if you put in the incorrect URL for the image, at least
    then it displays the Alt Text.
    The html code is very basic:
    <!-- InstanceBeginEditable name="Banner" --><img
    src="banners/2.jpg" alt="banner" name="Banner" width="950"
    height="120" border="0" /><!-- InstanceEndEditable
    --></td>
    SO the image is there somehow but the browser thinks its only
    1px across, if you put in plain text it displays fine? Can anyone
    help me with why this happens as I have tried everything I can
    think of - i'm not particularly good with html so it could be
    something elementary
    Thanks in advance

    >name="Banner" --><img src="banners/2.jpg"
    alt="banner"
    Sounds like the work of Norton. Don't ever use the word
    'banner' in any part of your images. Rename the image and alt text
    and see if that works.

  • Slideshow images will not display correctly on mobile phone

    Hello,
    I have a website which I used several slideshows, in areas I would typically just used a rectangle and fill with photo.  This was done because my client wants to be able to update the images through business catalyst.  Unfortunately, when viewed on a mobile phone (I am using iOS 7) the slide show images do not display correctly.
    What can be done to fix this?  Is there another workaround I should try?
    Thanks!

    Hi Nicole
    The images that you are using on parties page are stretched , if you check the image frame you can see that.
    As a result the image frame is stretched over the side image , they are not showing properly. If you resize from Muse end , then also it would not be fixed because Muse remembers the image size as you have inserted and when viewed , Muse stretches the image to original size as how it was inserted.
    Please resize the images outside Muse , use any image editor like Photoshop and then use the exact dimension of the image frame on page.
    This would resolve the issue.
    Thanks,
    Sanjit

  • Images will not display on Export to PDF

    I have a BOXi Web Intelligence Document that displays two images that are 7kb each.
    The Text for one of the objects is set to:
    http://cpolrhp.belvoir.army.mil/eur/images/CHRA_Logo.gif
    That object is set to read the text as:
    Image URL
    The images display on the report in web intelligence but they do not export to PDF when I select save to my computer as PDF.
    Any help on this would be a great help!!

    Hi Christopher,
    The behavior experienced by you is quite strange.
    When we save the document with image as Excel, the image goes missing and this is a known limitation but we can save it successfully to PDF.
    Suggest you to check for the Adobe version.
    You can also follow these steps:
    follow these steps to correctly redefine the object so that it appears on each page:
    1. Open the report.
    2. In the report, right-click on the image and go to Format Cell > "Alignment" tab.
    3. Check the option "Repeat On Every Page" and then click "Ok".
    4. Click on the dotted line representing the position of the header is and drag it down slightly.
    5. Go to Insert > Cell, insert a cell in the header of the report, and enter text in the cell.
    6. Right-click on the cell and go to Format Cell > "Appearance" tab and check the option "Hide Cell".
    7. Drag the header back into its original position.
    Regards,
    Ekta Srivastava
    8. Save the report and export it to the repository. The image will now be displayed on every page when the report is opened in PDF viewing mode.

  • Images will not display in website please help

    im using dreamweaver cs5. My custom images created in photoshop and saved as jpg will not upload into my website. i get a white box with a red x on the corner. I do have my images  in my images folder in my loca files and in my local image folder. It gives me an error saying that i might not have permission or images not in folder. Can some one help?

    Hi
    First you are posting in the wrong section of the forum for tthis question, use the dreamweaver general section - http://forums.adobe.com/community/dreamweaver/dreamweaver_general.
    As to your question, ensure you are running dreamweaver as administrator if you are using windows.
    Also check that the file paths in your html refer to your images folder as defined in your site definition.
    PZ

  • Image will not display in browser

    I have saved an image from online. When I insert the image into Dreamweaver, everything looks fine. However, when I display the page in a web browser (Explorer and Firefox), only the alternate text shows up. The image file is a jpeg. I have tried this process with gif's and png's. Both end with the same result.
    Any help will be appreciated,
    Sitez

    A link as Gary pointed out is the best way to see what the problem may be.
    Did you save the image to your working folder and have you defined a site pointing to this folder.
    Defining a site helps Dreamweaver track and organize the files used in this site.
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14028
    If you can't see the image, this means that the path to the image is incorrect.
    Nadia
    Adobe Community Expert : Dreamweaver
    Unique CSS Templates | Tutorials | SEO Articles
    http://www.DreamweaverResources.com
    Web Design & Development
    http://www.perrelink.com.au
    http://twitter.com/nadiap

  • Some images do not display on E-Bay with FF 11

    Running Vista. had no problems with E-bay using FF 10 or lower. some images will not display, and when a image that does show in the category, when selected, it does not display. I am running FF11 on my xp machine with no problems.
    every thing on E-bay works with IE

    It's not recommended to go back to Firefox 10 due to known security vulnerabilities. It's still available if there's no other solution.
    Another standard diagnostic step is to try Firefox's Safe Mode to see whether it is caused by a custom setting or add-on.
    First, I recommend backing up your Firefox settings in case something goes wrong. See [https://support.mozilla.com/en-US/kb/Backing+up+your+information Backing up your information]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
    Next, restart Firefox in [http://support.mozilla.com/kb/Safe+Mode Safe Mode] using
    Help > Restart with Add-ons Disabled
    In the Safe Mode dialog, do not check any boxes, just click "Continue in Safe Mode."
    If the images load correctly, this points to an add-on or custom setting or perhaps a saved password as the problem. A few things to work through.
    If the site doesn't load correctly, we would have to consider other factors.
    Any luck?

  • Images do not display in Acmevideo sample application WebApp_8i.jws

    Hello,
    The JDeveloper 3 Acmevideo web application for Oracle8i is a nice-looking web application.
    There is a syntax fault in the Java source files WebAppReports.java, WebApp.java of the JDeveloper 3 workspace WebApp_8i.jws
    In the file acmevideo_deploy.properties I used something like this:
    ...imageURL=http://oashost:80/acmeimages/...
    All occurrences of "/topmovie.gif", "/onoracle.gif","/filmsquare.gif" in the java source files WebAppReports.java, WebApp.java should be replaced by "topmovie.gif","onoracle.gif","filmsquare.gif". Otherwise these images will not display correctly in the web application.
    I would like to know when Oracle will provide a tutorial on servlet deployment of the acmevideo web application to Oracle Application Server.
    I understand that by providng a Java Webserver servlet deployment example the JDeveloper customer is not dependent on Oracle Application Server as web server.
    How to deploy the acmevideo servlet to Oracle Application Server 4.0.8.1?
    Thank you in advance for your reaction,
    Erik Martens
    null

    Hi Erik,
    For our next release, we are actually removing the Acme Video sample application. It will be replaced with the Web Auctions demo, which was used at the most recent Oracle Open World conference.
    Instructions for deploying DBServlets to OAS 4.0.8.1 are included in the JDeveloper 3.0 release notes.
    Laura
    null

  • Latest flash version will not display images or video

    Latest flash version will not display images or video in 2 x Windows 7 Pro 64bit machines, 1 x Windows 7 Home Premiums, and 1 x XP SP3 under VMWare Workstation 7. Problem plagues Firefox, Chrome, and IE on all systems. Also running Norton Security from Comcast on all machines. Disabling does not appear to help. Suggestions?

    Not sure, this is the one that I really want to view. I am using the latest 11.6 ending in 168. Curious you got the images. The product ones act like they should be displaying for me but don’t. Can you do a capture of the images? The text with small images sometimes comes through and sometimes not. I wonder if there is a problem on the server end.
    When I talk to the Customer Service people they claim to have no reports of problems, but like the sports pro about to be traded, they may be the last ones to know…

  • Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    If you think you're insane now, try maintaining those pop up menus.
    As far as I know, these menus have not been updated since FW 8, so 
    they are at least two versions old.
    Save yourself a lot of grief by avoiding those menus. There are many 
    other products on the market which do a much better job of creating 
    and maintaining this type of navigation structure.
    Read this link before you climb any higher on this slippery slope:
    http://apptools.com/rants/jsmenu.php
    There was another blog post by the fellow who originally wrote the pop 
    up menu feature, but I can't seem to locate it. Even he says stay away 
    from them.
    Not the answer you probably want, but I hope it helps, nonetheless.
    Jim Babbage

  • The safari software will not display images (pictures).  I have done the "reset" but still no help.  What should i try next?

    the safari software will not display images (pictures).  I have done the "reset" but still no help.  What should i try next?

        Safari > Preference > Advanced
        Checkmark the box for "Show Develop menu in menu bar".
        "Develop" menu will appear in the Safari menu bar.
        Click Develop and make sure that"Disable Images" is not enabled in the dropdown.

  • My images will not show in the Finder Pictures folders, but just display as jpeg thumbnails.  I have to open each one to see what photo it is.  This has just recently started to happen.

    My images will not show in the Finder Pictures folders, but just display as jpeg thumbnails.  I have to open each one to see what photo it is.  This has just recently started to happen.

    I made sure the 'Show Icon Preview' box was checked.  This is about all I can do, really, Frank, as i don't know enough about the workings of these machines to start fiddling about.
    Strangely the images show as previews in some folders, yet not in others, even though they come from the same sources (my camera and my phone).

  • Lightroom 2.1 will not display images.

    I use previous versions of Lightroom 1.3, 1.4, 2 Beta and they work fine. Now I upgraded to Lightroom 2.1 and Masters Collection CS4 and Lightroom 2.1 will not display images. All the images I import are just a shade of gray.
    When I adjust the parameters of the image the histogram is changing but the image is blank.
    I have a Vista machine.
    Thank you

    I have a Vista Home Premium, I am on Vista X86 and I just installed LR 1.4 and is working. Also LR2 Beta was working.
    So on the same Vista X86 machine LR 1.4 is working LR 2.1 is not displaying the images.
    This is the sysinfo:
    Lightroom version: 2.1 [512205]
    Operating system: Windows Vista Home Edition Service Pack 1 (Build 6001)
    Version: 6.0 [6001]
    Application architecture: x86
    System architecture: x86
    Physical processor count: 4
    Processor speed: 2.4 GHz
    Built-in memory: 3069.7 MB
    Real memory available to Lightroom: 716.8 MB
    Real memory used by Lightroom: 99.9 MB (13.9%)
    Virtual memory used by Lightroom: 75.2 MB
    Memory cache size: 65.9 MB
    Serial Number: 116040017170941123477699
    Application folder: C:\Program Files\Adobe\Adobe Photoshop Lightroom 2
    Library Path: C:\Users\Alex\Pictures\Lightroom\Lightroom 2 Catalog.lrcat

Maybe you are looking for