Loaded image on jPanel won't disappear

Gents, I have an image on a panel that I am drawing over with another image,
the problem is the new image will not appear because the previous image
keeps being displayed. there must be a way to completly erase the previous
image, thanks for any help.....
Jacques
This is the code that I am using to draw the image:
class ImagePanel extends JPanel
Image imageX;
int i;
int IMAGE_ID;
public ImagePanel (Image ImageX, int myInt, int IMAGE_ID)
imageX = theImage;
i = myInt;
public void setImage (Image myImage)
imageX = myImage;
repaint(300);
public void paint (Graphics g)
super.paint(g);
if (theTracker.checkID(IMAGE_ID, true))
g.drawImage(imageX, 0, 0, getSize().width, getSize().height, this);
if (i == 0) //i = 0 draw text labels on tank image not on FD Logo
//g.drawString(elevz1.getText(), 20, 45);
//g.drawString(atmphpress.getText(), 78, 13);
//g.drawString(pressh.getText(), 68, 48);
//g.drawString(vappress.getText(), 55, 119);
//g.drawString(frictf.getText(), 115, 119);
else
g.drawString("Loading image: please wait..", 10, 50);
repaint(300);
} //end class

hi.
you might want to override the paintComponent() method
this method is automatically called every time the JPanel component needs to redraw itself.

Similar Messages

  • "loading image"

    Product: Adobe Photoshop Lightroom 2 on Windows Vista.
    After using the trial version, i recently bought Photoshop Lightroom.
    I bought it because of the possibility to make webgallery's. I think it's very easy to use and i'm very happy with it.
    I have only one problem. When i upload the gallery to the webserver and look at the website in the browser, i get the message: "loading image" and it won't go away. I only see the gallery, but not his pictures.
    I thought i have done something wrong, but the gallery is working! I had put it on a other webserver and then it works!
    I don't know why it doesn't work on the other server and i have tried several things. I even put all the computer files of the site where it does work on the site that didn't work and uploaded the whole thing. I thought that there must be a file what connects with the gallery, but even then it doesn't work.
    I hope that someone knows what to do!

    Product: Adobe Photoshop Lightroom 2 on Windows Vista.
    After using the trial version, i recently bought Photoshop Lightroom.
    I bought it because of the possibility to make webgallery's. I think it's very easy to use and i'm very happy with it.
    I have only one problem. When i upload the gallery to the webserver and look at the website in the browser, i get the message: "loading image" and it won't go away. I only see the gallery, but not his pictures.
    I thought i have done something wrong, but the gallery is working! I had put it on a other webserver and then it works!
    I don't know why it doesn't work on the other server and i have tried several things. I even put all the computer files of the site where it does work on the site that didn't work and uploaded the whole thing. I thought that there must be a file what connects with the gallery, but even then it doesn't work.
    I hope that someone knows what to do!

  • Why won't safari load images and connect to websites?

    We've had this problem intermittently for several months. When visiting SOME websites (though never the same ones twice) instead of loading images, it comes up with a blue question mark in a box. if we try to reload the page, it will do one of two things: it will either reload exactly the same, or, it will reload in a format that shows vertical written links - no images. it almost looks like programming language, but it's readable.
    also, when we go between links, we often get the message that "safari can't find the server". this is, again, erratic. If i try to go directly to the same website by typing in the address in the bar, i will get the connection. (so, if i go from youtube for example to try to connect to another website it won't work. but if i try to go directly to that website by just typing in the address myself, i can get it.) as i said, it doesn't always happen, but when it does it's a real pain!
    lately, i've had a new problem too, which seems to relate: when using hulu.com, it will not load the show saying it is unavailable and to clear my cache. I've done that... and it still won't reload. yet, when i go to google, and search hulu.com, and go to the website that way, i can get to the show page no problem. Or, i have to quit safari and then go back to hulu and, again, no problem.
    sometimes we can go for days without the problem, sometimes not.
    any ideas on how to help this problem would be MOST appreciated! thanks

    blue question mark in box
    Go to Safari > Preferences then select the Appearance tab. Make sure Display images when the page opens is selected.
    For server issues, try turning off the router for a few minutes, then restart it.
    Hulu requires the Flash plugin. Uninstall your current copy of Flash, then reinstall >  Troubleshoot Flash Player | Mac OS
    Try emptying the Safari cache more often.
    And reset Safari. From your Safari menu bar click Safari > Reset Safari. Select the top 5 boxes, click Reset.
    And how much free space on the startup disk?     Right or control click the MacintoshHD icon. Click Get Info. In the Get Info window you will see Capacity and Available. Make sure there's a minimum of 15% free disk space.
    Try Safari in another user account. Same problems there, then log back into your admin account, launch Disk Utility.  /Applications/Utilities
    Select the startup disk in the panel on the left then select the First Aid tab.
    Click: Verify Disk  (not Verify Disk Permissions). If the startup disk needs repairing, follow the instructions for Using Disk Utility to verify or repair disks

  • Images in firefox won't load on android

    images in firefox won't load on android. there is no option to click to download images - there is nothing in the image boxes at all.

    Can you please update to Firefox 19?

  • I was changing my desktop screen saver in system preferences screen protection.  Now it says it is "Loading Images" and won't stop.  The Colourful wheel goes around for ever and It does not stop. Can anyone help me?

    I was changing my desktop screen saver in system preferences>screen protection.  Now it says it is "Loading Images" and won't stop.  The Colourful wheel goes around for ever and It does not stop. Can anyone help me?

    Welcome to the Apple Support Communities
    I have seen a lot of cases like your issue, and it's easy to solve.
    First, open Disk Utility, select Macintosh HD in the sidebar and repair permissions. Sometimes, a permission can be damaged and it makes that an application doesn't work properly.
    If that doesn't work, open Finder, select Go menu > Go to Folder, type ~/Library/Prefereces, delete "com.apple.desktop.plist" and "com.apple.systempreferences.plist" and restart

  • Photoshop CS5.1 Won't Load Images On Screen at retina MacBook pro.

    Photoshop CS5.1 Won't Load Images On Screen at retina MacBook pro. Any help? Thanks!

    I'm surprised that Apple would attempt such a "hack" design...  Switching graphics adapters mid-stream is no small task, and I can't imagine that they could ever make it work seamlessly.
    Keep in mind that the nature of the complex GPU beast is that graphics hardware doesn't all work the same (or right) and application software has to make decisions about what to do and what not to do, and even when to invoke certain workarounds - or it would never be possible to run on multiple platforms. 
    Yes, that seems wrong, but it's necessary and it makes developing cutting-edge graphics applications in the real world much more expensive.
    The decisions aren't re-made by an application all the time - that would slow things down terribly.  Instead, often the run-time environment is characterized at application startup and the features remembered for later use.  Modern applications actually even create programs (e.g., shaders or OpenCL programs) to run on specific GPU hardware, and they have to be compiled - something usually done by the application at startup.
    Now imagine that someone changes the capabilities of the graphics hardware completely after the application has started - even from one vendor's implementation to another (Intel to nVidia).
    Like I said, I'm surprised a reasonable system designer could ever think that swapping GPUs at run-time could be made to work.  At least Apple allows you to turn it off!
    Does Apple offer any "geek-level" configuration options that can force the use of a particular GPU for a given application?  It seems that this could be an automated workaround that would allow a given application to see only one GPU, which is what Photoshop appears to need here.
    -Noel

  • Disappearing of "Load Images"

    Hello,
    In Leopard I used to have in incoming mails on the top right of the window, the command " Load Images" to enable presenting images coming with the mail.
    After installation of 10.6 this command has disappeared in the incoming mails.
    Where I can configure it back?
    TIA

    riklar wrote:
    On 10.6.1 the mail version I have is 4.1, but in the View pane it has the same command, and it is ticked as well, but with no luck, for me.
    You may have a corrupted Mail preference file. I'd first try to uncheck that preference, close the preference panel (and possibly Mail itself), then open the preference panel again and check the option.
    I'd managed somehow to turn that option off when composing my earlier reply. In turning it back off, it seemed that it took place immediately. However, it wouldn't hurt to close things between changes.
    I discovered the "plist" file that seems to contain that preference setting. (At least that's a file with a date that changes when the setting is changed. I didn't see the actual preference item.) However, I wouldn't suggest trashing it to cure your problem. That file contains a lot of other things. If you trashed it you might risk losing all your saved messages.

  • Loading Images in CrEme JVM

    Hi all,
    I'm trying to load images on an HP iPAQ using the CrEme JVM for Windows CE 4.1. I'm using the awt Toolkit getImage() method with a MediaTracker. Everything runs fine on the desktop, but CrEme won't render any images. Here's my code:
    package ImageTest;
    import java.awt.*;
    import java.io.*;
    public class ImageTest extends Frame
         Image m_Image;
         public ImageTest()
              setVisible(true);
              setSize(Toolkit.getDefaultToolkit().getScreenSize());
              setTitle("Image Test");
              try
                   MediaTracker mt = new MediaTracker(this);
                   m_Image = Toolkit.getDefaultToolkit().getImage("filename.gif");
                   mt.addImage(m_Image, 0);
                   mt.waitForAll();
                   System.out.println("Image dimensions: " + m_Image.getWidth(null) + ", " + m_Image.getHeight(null));
                   paintComponent(this.getGraphics());
              catch(Exception e)
                   e.printStackTrace();
         public void paintComponent(Graphics g)
              g.drawImage(m_Image, 0, 0, null);
         public static void main(String[] args)
              ImageTest test = new ImageTest();
    }If anyone knows any method of loading images in CrEme, I would greatly appreciate it.
    Thanks.

    I have the same problem using Creme. I would really very grateful if you could help me...
    package src;
              import java.awt.*;
              import java.awt.image.BufferedImage;
              import javax.swing.*;
              public class MapPanel extends JPanel {
                   Image image;
                   BufferedImage mBufferedImage;
                   int width = this.width;
                   int height = this.height;
                   static String path = "/resources/Forum.jpg";
                   public MapPanel()
                        loadImage(path);
                   createBufferedImage();
                   public void loadImage(String fileName)
                   try
                        image = Toolkit.getDefaultToolkit().getImage(fileName);
                        MediaTracker mt = new MediaTracker(this);
                        mt.addImage(image, 0);
                        mt.waitForAll();
                   catch(InterruptedException ie)
                        ie.printStackTrace();
                   return;
                   public void createBufferedImage()
                   mBufferedImage = new BufferedImage(image.getWidth(this),
                   image.getHeight(this),
                   BufferedImage.TYPE_INT_RGB);
                   Graphics2D g2 = mBufferedImage.createGraphics();
                   g2.drawImage(image, 0, 0, this);
                   g2.dispose();
                   public void paintComponent(Graphics g)
                        super.paintComponent(g);
                   g.drawImage(image, 0, 0, this);
              }

  • Background Image in JPanel.

    Hi, I am trying to set a background image to my JPanel. So far everything ok. However When I add labels to this panel as well the image is displayed but the label is not! I tried to make a search on google, and I found some links pointing to this forum, however none of them (which) I have seen show how to display a backgroun image and a label on top.
    What I tried to to is override the paint method of the JPanel. Here I did the following code:
    public void paint(Graphics g){
       Image i = this.myImage // Were myImage is of type Image with a loaded image in.
       g = super.getGraphics();
       g.drawImage(i, 0, 0, this);
       super.paint(g);
    }However this code brings the label and the image always blinking. I can imagine the reason for this is that the paint method is called all the time, and thus the image and the label are being painted all the time and so there is the blinking effect.
    Does anyone know how I can set a background image to my JPanel in an efficient way?

    No Gosling? I just retried it and it works for me.
    Maybe you're having trouble with the image URL.
    Try it with a local image.

  • Can you auto-load images in junk mail?

    Am I wrong in thinking that once you could make a choice to load images automatically when opening junk mail? Can you now?

    No, there is not. It wouldn't be reliable or useful. If Mail filters it as junk, presumably you won't be opening it, and thus loading the images, anyway. On the other hand, if it fails to recognize one message as spam and you open it, you'll load the images and become a "marked man." (ie, your address will be tagged as one where the spam is opened)

  • How to display image at jpanel in application GUI

    i wana load an image from given location to my GUI when application starts.
    according to my perception this code should load image but its not working.
    Will any body kindly help me and point out the "reasons" for not working following piece of code from my application.
    public class MainFrame extends JFrame
    JPanel jPanel1 = new JPanel();
    JPanel jPanel2 = new JPanel();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    Image image = Toolkit.getDefaultToolkit().createImage("c:\\form-3.jpg");
    javax.swing.JScrollBar jScrollBar1 = new JScrollBar();
    BorderLayout borderLayout1 = new BorderLayout();
    public MainFrame()
    try
    jbInit();
    } catch (Exception ex)
    ex.printStackTrace();
    public static void main(String[] args)
    MainFrame mainFrame = new MainFrame();
    private void jbInit() throws Exception
         //jbInit() defined here
    public void paintComponent(Graphics g)
    // jPanel1.getGraphics().drawImage(image,0,0,jPanel1);
    Graphics2D g2D = (Graphics2D) g;
    BufferedImage bi = (BufferedImage) createImage(getWidth(),getHeight());
    bi.createGraphics().drawImage(image, 0,0, jPanel1);
    // g.drawImage(image,0,0,jPanel1);
    public void jButton2_mouseClicked(MouseEvent e)
         public void jButton1_mouseClicked(MouseEvent e)
    this.dispose();
    System.exit( 0 );
    /////////////////////////////////////////////////////////////////////////////

    this works OK
    (stripped of everything unrelated to your question)
    import javax.swing.*;
    import java.awt.*;
    class MainFrame extends JFrame
      Image image = Toolkit.getDefaultToolkit().createImage("test.gif");
      public static void main(String[] args)
        MainFrame mainFrame = new MainFrame();
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainFrame.setSize(200,200);
        mainFrame.setVisible(true);
      public void paint(Graphics g)//<-----heavyweight component
        super.paint(g);
        g.drawImage(image,50,50,this);
    }

  • How to load images from css file in JavaFX 8

    I have this css file which loads images in JavaFX 8 application:
    #pill-left {
        -fx-padding: 5;
         -fx-border-image-source: url("/com/dx57dc/images/left-btn.png");
        -fx-border-image-slice: 4 4 4 4 fill;
        -fx-border-image-width: 4 4 4 4;
        -fx-border-image-insets: 0;
        -fx-border-image-repeat: stretch;
         -fx-background-color: null !important;
    #pill-left:selected { -fx-border-image-source: url("/com/dx57dc/images/left-btn-selected.png"); }
    #pill-left .label {
        -fx-text-fill: #d3d3d3;
        -fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 0 , -1 );
    #pill-left:selected .label {
        /* -fx-text-fill: black; */
        -fx-text-fill: white;
        -fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
    #pill-center {
        -fx-padding: 5;
         -fx-border-image-source: url("/com/dx57dc/images/center-btn.png");
        -fx-border-image-slice: 4 4 4 4 fill;
        -fx-border-image-width: 4 4 4 4;
        -fx-border-image-insets: 0;
        -fx-border-image-repeat: stretch;
         -fx-background-color: null !important;
    #pill-center:selected { -fx-border-image-source: url("/com/dx57dc/images/center-btn-selected.png"); }
    #pill-center .label {
        -fx-text-fill: #d3d3d3;
         -fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 0 , -1 );
    #pill-center:selected .label {
        -fx-text-fill: black;
        -fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
    #pill-right {
        -fx-padding: 5;
        -fx-border-image-source: url("/com/dx57dc/images/right-btn.png");
        -fx-border-image-slice: 4 4 4 4 fill;
        -fx-border-image-width: 4 4 4 4;
        -fx-border-image-insets: 0;
         -fx-border-image-repeat: stretch;
        -fx-background-color: null !important;
    #pill-right:selected { -fx-border-image-source: url("/com/dx57dc/images/right-btn-selected.png"); }
    #pill-right .label {
         -fx-text-fill: #d3d3d3;
        -fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 0 , -1 );
    #pill-right:selected .label {
        -fx-text-fill: black;
        -fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
    The images are located at the Java package com.dx57dc.images
    In Java 7_25 this code works as expected but in JavaFX 8 b99 I get this error:
    ava.lang.NullPointerException
    at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1129)
    at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:1598)
    at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1520)
    at com.sun.javafx.sg.prism.NGGroup.renderChildren(NGGroup.java:233)
    at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:199)
    at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1249)
    at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:1598)
    at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1520)
    at com.sun.javafx.sg.prism.NGGroup.renderChildren(NGGroup.java:233)
    at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:199)
    at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1249)
    at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:1598)
    at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1520)
    at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:99)
    at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:210)
    at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:95)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
    at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:129)
    at java.lang.Thread.run(Thread.java:724)
    D3D Vram Pool: 13,331,480 used (5.0%), 13,331,480 managed (5.0%), 268,435,456 total
    20 total resources being managed
    4 permanent resources (20.0%)
    1 resources locked (5.0%)
    7 resources contain interesting data (35.0%)
    0 resources disappeared (0.0%)
    D3D Vram Pool: 13,331,480 used (5.0%), 13,331,480 managed (5.0%), 268,435,456 total
    20 total resources being managed
    4 permanent resources (20.0%)
    1 resources locked (5.0%)
    7 resources contain interesting data (35.0%)
    0 resources disappeared (0.0%)
    D3D Vram Pool: 13,331,480 used (5.0%), 13,331,480 managed (5.0%), 268,435,456 total
    20 total resources being managed
    4 permanent resources (20.0%)
    1 resources locked (5.0%)
    7 resources contain interesting data (35.0%)
    0 resources disappeared (0.0%)
    What is the proper way to load images from css in Java 8?
    Ref
    How to load images from css file in JavaFX 8 - Stack Overflow

    There is nothing special to do - you execute the statement from your program just like any other SQL statement.  The only thing to be aware of are the privilege/permission issues:
    When loading from a file on a client computer:
    READ CLIENT FILE privilege is also required for the database user.
    Read privileges are required on the directory being read from.
    The allow_read_client_file database option must be enabled.
    The read_client_file secure feature must be enabled.
    Revoking these privileges is also the only way you can prevent a user from executing the statement.

  • How can i make firefox not load images from certain websites permanantly

    I am unable to block images on certain websites permanently. However, I can block images temporarily for a session through Option > Content > Load images automatically but whenever i clean the browser history or close down firefox the customized list that i entered disappear and i am back to square and again manually enter websites one by one and the same thing happens again.

    You can inspect and manage the permissions for all domains on the <b>about:permissions</b> page.
    *https://support.mozilla.org/kb/how-do-i-manage-website-permissions
    In case you are using "Clear history when Firefox closes":
    *do not clear the "Site Preferences"
    *Tools > Options > Privacy: History: [X] Clear history when Firefox closes > Settings
    *https://support.mozilla.org/kb/Clear+Recent+History
    Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.

  • Load image from a cursor .cur file.

    Hi all,
    I want to create a customized cursor, and I have a Microsoft cursor .CUR file. Can I load this .cur file as an image? - Thank you
    Edited by: trangkd on Aug 9, 2011 3:08 PM

    Hi,
    I've been google-ing up-and-down, but couldn't find any implementation of .cur and Java. If anyone has done so, please post... I was looking for an easy way i.e. couple lines of code to load image from a .cur file .. like we do with gif or jpeg out of the box. The JIMI has an extensive support of many other formats, and it will be an alternative if the graphics department won't give us a new set of cursor images in gif/jpg format.
    Thanks so much.

  • Why are my Content Load images -- Exceptions settings not saved?

    I designate certain sites as exceptions under Content > Load images automatically. The next time I open Firefox, those exceptions are not there.
    This also happens under Privacy > Accept cookies from sites. The exceptions that I put in disappear the next time I open Firefox.
    How can I make these exceptions permanent?

    In case you are using "Clear history when Firefox closes":
    *do not clear the Site Preferences
    *Tools > Options > Privacy > Firefox will: "Use custom settings for history": [X] "Clear history when Firefox closes" > Settings
    *https://support.mozilla.org/kb/Clear+Recent+History
    Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.
    You can inspect and manage the permissions for all domains on the <b>about:permissions</b> page or for the current domain via the "Site Identity Button" (globe/padlock) on the location bar and click "More Information" to open "Page Info" and go to the Permissions tab.
    *https://support.mozilla.org/kb/how-do-i-manage-website-permissions
    You can delete the permissions.sqlite file to reset all permissions.

Maybe you are looking for