Displaying an image in a application, not an applet

I know that this is a simple process, but I can not figure out how to display a simple image like a jpeg or something. Could someone help me out here.

how do I give the path for the imageFor questions like this you'll more quickly find the answer from the API documentation: http://java.sun.com/j2se/1.4/docs/api/
The particular class in question now is java.awt.Toolkit:
http://java.sun.com/j2se/1.4/docs/api/java/awt/Toolkit.html

Similar Messages

  • How to display an image if user does not have flash installed?

    Hi, Not all people have flash and the ones that don't will
    have an unpleasant experience on my website. How can I display an
    image instead of the flash itself for people that don't have flash
    who visit my website? I just have flash on the upper portion of the
    website. Please explain how I can do this! I haven't done flash in
    a long time so be simple! Thank you!

    In the site you can download the SWFObject1.5.
    It includes a javascript which is embeding the flashmovie
    with vallidaton.This swfobject.js can be used for any html.

  • How do I display an image in an APPLICATION

    I have the following code and I want to display an image. I figured that the easiest way to display an image was via a JLabel.
    import javax.swing.*;
    import java.awt.*;
    public class NewMain {
        public static void main(String[] args) {
            JFrame win = new JFrame("TestApp");
            win.setDefaultCloseOperation(win.EXIT_ON_CLOSE);
            win.setBounds(0,0,200,200);
            ImageIcon icon = new ImageIcon("ca.bmp");
            JLabel label = new JLabel("",icon,JLabel.CENTER);
            win.add(label);
            win.setVisible(true);
    }What am I doing wrong. I have the cd.bmp file in the source directory but I just get an empty frame when I run the program...
    PS: I get a lot of hate messages in other forums. I am BRAND new to programming anything (especially OOP). I realize I suck at this but that is why I am trying to learn.

    You need to become familar with Sun's tutorials, like this one about labels:
    http://java.sun.com/docs/books/tutorial/uiswing/components/label.html
    It has an example and code for what you want to do.

  • How to put sound in an application (not an applet)

    i was wondering how to put sound in a application.
    what code do i need and where should i put it

    Please do not create duplicate threads. Abandon this one and continue to post in your original here:
    http://forum.java.sun.com/thread.jspa?threadID=5203167&messageID=9810376#9810376

  • DISPLAYING IMAGES IN WEB APPLICATIONS

    When we store images in a column, we are having problems reading and displaying it on web applications.
    can somebody help?
    Thomas

    What version of Oracle do you use? What is the datatype of the column where images are stored? What are you using to read and display the images on web applications? Do you get any errors?

  • How to add images into a java application (not applet)

    Hello,
    I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
    Thank you,
    Oscar

    Your' better off looking in the java 2d forum.
    package images;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.FileInputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    /** * LogoImage is a class that is used to load images into the program */
    public class LogoImage extends JPanel {
         private BufferedImage image;
         private int factor = 1; /** Creates a new instance of ImagePanel */
         public LogoImage() {
              this(new Dimension(600, 50));
         public LogoImage(Dimension sz) {
              //setBackground(Color.green);      
              setPreferredSize(sz);
         public void setImage(BufferedImage im) {
              image = im;
              if (im != null) {
                   setPreferredSize(
                        new Dimension(image.getWidth(), image.getHeight()));
              } else {
                   setPreferredSize(new Dimension(200, 200));
         public void setImageSizeFactor(int factor) {
              this.factor = factor;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              //paint background 
              Graphics2D g2D = (Graphics2D) g;
              //Draw image at its natural size first. 
              if (image != null) {
                   g2D.drawImage(image, null, 0, 0);
         public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
              LogoImage logoImage = new LogoImage();
              BufferedImage image;
              try {
                   FileInputStream fileInput =
                        new FileInputStream("images/" + filename);
                   image = ImageIO.read(fileInput);
                   logoImage =
                        new LogoImage(
                             new Dimension(image.getWidth(), image.getHeight()));
                   fileInput.close();
                   logoImage.setImage(image);
              } catch (Exception e) {
                   System.err.println(e);
              return logoImage;
         public static void main(String[] args) {
              JFrame jf = new JFrame("testImage");
              Container cp = jf.getContentPane();
              cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
              jf.setVisible(true);
              jf.pack();
    }Now you can use this class anywhere in your pgram to add a JPanel

  • How to display stored image in jsp  in ie7???

    i am using internet explore7. i have a problem when i am displaying an image in jsp its not properly coming. this image and image is stored in database.
    image is stored in database using "binarystream" .
    i am just simply calling the image path and using the html image display tag.
    <img src="<%=fileIpath%>" but image is not coming properly but this image is showing properly in lower ie version.
    Can anyone help me???

    can anyone reply this question??Appearently no.
    It might be that the question is not interesting enough to attract people.
    Or it might be that the details you provided do no suffice and some important pieces of information are missing. For eample: what are the contents of the variable? If you save the generated page, what do you get?

  • Displaying internal image on a push button

    Hi,
    I am running oracle forms 11.1.2.0.0.
    I create a push button and under object property make it an iconic yes
    and under iconic file name I have "java/oracle/forms/icons/save.gif"
    During run-time it displays a image but it is not of save, it is an image of badimage.gif
    Even if I change save.gif to print.gif it is same result.
    What am I missing?
    Thanks
    Munish

    Munish wrote:
    Hi,
    I am running oracle forms 11.1.2.0.0.
    I create a push button and under object property make it an iconic yes
    and under iconic file name I have "java/oracle/forms/icons/save.gif"
    During run-time it displays a image but it is not of save, it is an image of badimage.gif
    Even if I change save.gif to print.gif it is same result.
    What am I missing?
    Hi Munish
    Do you read {thread:id=2513867}

  • Displaying DICOM images in JPanel

    Can anyone please tell me how to display DICOM images using JPanel? I can use JPanel to display ordinary images but it does not seem to work using DICOM images. Can anyone please help me out? I've spent hours and hours trying to solve this problem. Thank you in advance.

    Can anyone please tell me how to display DICOM images
    using JPanel? I can use JPanel to display ordinary
    images but it does not seem to work using DICOM
    images. Can anyone please help me out? I've spent
    hours and hours trying to solve this problem. Thank
    you in advance.The JPanel is only able to display JPEG and GIF images, you will need to decode the DICOM image first and convert to JPEG or GIF format, there are some source codes available on the net. Also check this link out
    http://www.dclunie.com/medical-image-faq/html/part8.html

  • Image UI element is  not displayed in Abap webdynpro application

    Hi Experts,
    I need your advice on below issue.
    I have created new ABAP Webdynpro application just to
    display employee photo.
    When loading the application, I generated a dynamic URL for
    a image in webdynpro application path in cache to map to Image UI Element. It
    is working well in DEV and QA environment. But it is not displaying when loaded
    in PRD system.
    Please suggest where to check the cache properties in system
    in order to resolve this issue.
    The user can access the application path, is there any chance for security issue in the same path?
    I suspect the URL is cleared before user access it, can it be controlled via any config?
    Looking forward for your valuable inputs.
    Thanks,
    Swetha

    HI Swetha,
    Maybe the image is not present in MIME repository for the PRD system.
    Please check.
    Regards,
    Hancila

  • How to  upload and display image using bsp application

    hi
    I  just wants to know that
    1- how to  upload image from BSP page with attachment into sap server .?
    2-how to display image in to BSP page(webpage).
    thanks

    Hello Gupta Prashant,
    Just to upload and display an image, import image in MIME repository. Not only still images but also flash files can also be uploaded in the MIME repository. Once you import the image in it, use normal html code for image call;
    <img src = "file.jpg/gif" width=  height=>
    Besides it, if your requirement is to store the image in the database and fetch it based on specified field-name, then you have to go for BLOBs i.e Binary Large Object, using this you can also store images, videos, pdfs, applications in the database.
    MBLOB - Medium BLOBs store videos and pdfs,
    LBLOB  - Large BLOBs store movie files and applications.
    You have got 2 ways to use it; some databases store BLOB objects into themselves and some store the path of the BLOB object maintained on the FTP server.
    You can also implement it in ABAP;
    read the following link and practice the tutorial;
    [ Use of MIME Types|http://help.sap.com/saphelp_45b/helpdata/en/f1/b4a6c4df3911d18e080000e8a48612/content.htm]
    also check this
    [TYPES - LOB HANDLE|http://help.sap.com/abapdocu/en/ABAPTYPES_LOB_HANDLE.htm]
    And looking at your question, in order to upload an image, you can make use of FILEUPLOAD tag provided by HTMLB.
    Step 1: FILEUPLOAD provides a browse button to choose desired image file.
    Step 2: Store that image in database using BLOBs.
    Step 3: Retrieve the image using normal select query and display it on the screen.
    Hope it helps you,
    Zahack

  • Image displays in some jsp files but not others

    OK, I have a jsf jsp pages js tag for my application that occurs in several jsp pages:
    <tr>
       <td>
          <jsp:include page="/includes/footer.jsp"/>
       </td>
    </tr>     footer.jsp has an image tag like this:
    <td align="left"><img src="images/logo.jpg" alt="X Systems"/></td>     The jsp files are in a directory which is under the base directory like the include and image files. For some reason, in one jsp page the logo.jpg file does not get displayed. As I understand it, the application server jboss/tomcat resolves the image files. Why would it be displayed it in one page and not another?

    You are using a relative link to access your image.
    That means it will look for your image relative to the page it last served.
    If you ask for http://myapp/root.jsp, it will locate http://myapp/images/logo.jsp
    If you ask for http://myapp/module/index.jsp it will locate http://myapp/module/images/logo.jsp
    If you right click on your image / broken image placeholder and look at its properties, you should be able to see the url which it is trying to fetch the image from.
    The client will resolve relative links from the address url it last accessed. It knows nothing of any serverside forwards/includes that you might have done.
    So if you access http://myapp/action and forward to /moduel/accounting/balanceSheet.jsp it will still treat the url as http://myapp/action for resolving relative links.
    As far as the client is concerned, the root is /
    As far as your web application is concerned, the root is /myapp (or whatever your context name is)
    Because of this you can't give your images an static absolute url, because you would be hardcoding the context name into your jsp.
    Alternatives
    - use something like <img src="<%= request.getContextName() %>/images/logo.jsp"/>
    - use a tag library to hide the implementation of option #1 (like struts tag html:img)
    - only use relative links, and always specify a html <base> on your page to resolve relative links from.
    Hope this helps,
    evnafets

  • Display an Image in a Java application !

    Hi all !
    Really i want to display an image in a java application , i know how to do it in applets but this method does not work in applications so please help me to do that in an application ,thanks .

    it is the same way as in applets.
    1. Open a frame with awt
    2. Define an Image (like: Image a=null;)
    3. Load this Image with the Toolkit....(just look which method to use)
    4. draw this image to screen with g.drawImage(...)
    Note the class drawing the image must implement ImageObserver.
    regards

  • Displaying an image in a stand alone application

    I know that this is a simple process, but I do not know how to display an image in a stand alone application.

    public class MyFrame extends Frame {
    Image image;
    MyFrame() {
    image = getToolkit().getImage(pathToImage);
    setSize(800,600); //for example
    show();
    public void paint(Graphics g) {
    super.paint(g);
    if(image != null)
    g.drawImage(image,0,0,this);
    }

  • Why are some emails not displaying remote images

    There have been a few threads on similar subjects but I haven't found a solution, or even a reason for the problem I'm seeing.
    I've the display remote images option to "on" and in most of my emails images are shown. But for all the messages from one domain no images are ever displayed. The URLs are valid because the images show on my iMac in Thunderbird. On my iPhone I get a placeholder (box) with either a question mark or the "alt" text for the image.
    Does anyone have any ideas about what might be causing the problem?

    Sent messages moved to the account's Sent mailbox indicates the message was successfully sent by the SMTP server used to send the messages with the account but is no guarantee the message will be accepted by the recipient's incoming mail server.
    The recipient's incoming mail server may be incorrectly flagging messages sent by this SMTP server as junk (messages sent via webmail access for the account does not use an SMTP server) and with the large amount of spam being circulated, a return email error message from the recipient's incoming mail server is no longer always provided if the message was not accepted by the recipient's incoming mail server or when flagged as junk by the incoming mail server.
    This is not a problem with the Mail application. The recipients reporting this problem need to check with the email account provider for their account.

Maybe you are looking for

  • "No Child Processes" Error

    When I am downloading certain files from the internet, the files are not mounting, and I am getting a "No child Processes" Error. I have run the apple repair disc over the computer, however, the problems is still happening. Can anybody help to me fix

  • Is FoxTab 1.4.10 Compatible with windows 8.1 64bit

    retired my vista 64 bit desktop(inspiron530) and bought an XPS8700(win 8.1 64bit)FoxTab 1.4.10 work fine with it especially the TopSites feature.Well FoxTab Doesn't work at all with the new Desktop,tab switching,topsites etc.I have repeatedly emailed

  • Exclude a word from a spotlight search?

    How can I tell spotlight to exclude items containing a particular word from the search? In other words, I am looking for something similar to google's "-word" option: example (google) of a search command for google: +mac -software (show all items con

  • Scipt to prompt and authenticate users to AD and then map 2 next available drive letters to 2 network shares

    Hi, So I have been trying to write some code that will prompt users to authenticate to AD and use that authentication to map the next 2 available drive letter to two network shares. I have adopted using the HAT format as this provides me with the abi

  • Custom cursor that follows mouse - JITTERS

    Hi again. I'm using this code to make my custom cursor follow the mouse, HOWEVER when it gets near to the mouth it goes loopy - and turns left and right in a fit. Can I put code in there for it to be smoother? The CODE is lower done highlighted in BL