HI, I need to display an image in a Label

how can i get that?

Hi,
JLabel label=new JLabel(new ImageIcon("myImage.gif"));Take a look at: http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/JLabel.html

Similar Messages

  • Displaying of image in table cells

    Hi,
    I have a requirement where i need to display an image in table cell editor. Can anyone please tell how to do this.
    Thank You,
    Madhavi

    Hi
    The link is related to the same code as well..
    First copy all your images into "project/src/mimes/components/<packagename>"
    1) First create a new column for image and insert Child "Image" UI Element
    2) Create a Context in a view in which you are using Image UI Element
    3) Value Node
    Name : Image
    Cardidality : 1..1
    4) create 2 Value Attributes
    4)a ImageAlt (Calculate property - true)
    4)b ImageSrc (Calculate property - true)
    5)Bind the properties of Image
    alt - Image.ImageAlt
    source - Image.ImageSrc
    6) in getImageSrc()
    //according to your condition use your image
    retrun "XX.gif"
    7) in getImageAlt()
    return "Image Not Available"
    Case 2 :
    1) Add a new String attribute to your existing context
    2) Right click on your table in RootUIElememntContainer
    3) Edit Sturcture Binding
    4) Select the context which you modified , Select next
    5) in the next step for the newly created attribute select imageUIElement as type
    If you want to use that in wdDoinit()
    bind the two string value attributes to alt and source properties of ImageUIElement and write the following code
    in doinit
    wdContext.currentContextElement.set<src>("img1.gif") ;
    wdContext.currentContextElement.set<alt>("Image not found") ;
    Best Regards
    Chaitanya.A

  • How to display FITS images?

    Hi,
    I need to display certain images of a format called FITS(Flexible Image Transport System).Such FITS images are used in astronomical studies.
    Does anybody have idea about that?

    If the id of the image control is myImg then you can do so: (say you var fileReference: FileRefereence)
    myImg.source = fileReference.data

  • Really need to show an image in this applet...

    Hi,
    I need to display an image in my applet as a sort of "Start Screen" like you get on games.
    But I'm damned if I can get it to work, my tutor provided the unifinished shell of a program, and it seems that I need to display this image before any... panels.. or whatever it is... are initiated. So I could either create a new one, just to show this image, then make it go away when the image does, or, have it popup as part of a message box, or something.
    I stumbled on a splash screen feature, found in Java 1.6, but although I'm using 1.6, my university still uses 1.5, so it's a no go.
    Ideally, it would be a popup window I think, more like a fancy about box than a title screen. But I don't know how to do that either, so any help would be greatly appreciated ^^
    Thanks

    Look into addNotify() and MediaTracker.

  • Hi , How to display multiple images

    hi,
    please help me out!
    I need to display multiple images on the jframe or on a jpanel . From the database where the path of the images are stored how to do it any one please
    give the code

    import java.awt.*;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import java.net.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class ShowingImages extends JPanel
        final int
            WIDTH  = 75,
            HEIGHT = 125;
        public ShowingImages()
            String[] filePaths = getPaths();
            BufferedImage[] images = getImages(filePaths);
            setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(5,5,5,5);
            gbc.weighty = 1.0;
            gbc.weightx = 1.0;
            loadImages(images, gbc);
        private void loadImages(BufferedImage[] images, GridBagConstraints gbc)
            for(int j = 0; j < images.length; j++)
                BufferedImage scaled = scale(images[j], WIDTH, HEIGHT);
                ImageIcon icon = new ImageIcon(scaled);
                if(j % 2 == 0)
                    gbc.gridwidth = GridBagConstraints.RELATIVE;
                else
                    gbc.gridwidth = GridBagConstraints.REMAINDER;
                add(new JLabel(icon), gbc);
        private String[] getPaths()
            String[] fileNames = {
                "images/redfox.jpg", "images/greathornedowl.jpg",
                "images/bclynx.jpg", "images/mtngoat.jpg"
            return fileNames;
        private BufferedImage[] getImages(String[] fileNames)
            BufferedImage[] images = new BufferedImage[fileNames.length];
            for(int j = 0; j < fileNames.length; j++)
                images[j] = loadImage(fileNames[j]);
            return images;
        private BufferedImage loadImage(String fileName)
            BufferedImage image = null;
            try
                URL url = new URL("file:" + fileName);
                image = ImageIO.read(url);
            catch(MalformedURLException mue)
                System.err.println("malformed url for image: " + mue.getMessage());
            catch(IOException ioe)
                System.err.println("unable to read image file: " + ioe.getMessage());
            return image;
        private BufferedImage scale(BufferedImage source, int w, int h)
            BufferedImage scaled = new BufferedImage(w, h, source.getType());
            Graphics2D g2 = scaled.createGraphics();
            g2.setPaint(getBackground());          // background for
            g2.fillRect(0,0,w,h);                  //   scale to fit
            double width = source.getWidth();
            double height = source.getHeight();
            double xScale = w / width;
            double yScale = h / height;
            double scale = Math.min(xScale, yScale);      // scale to fit
            //double scale = Math.max(xScale, yScale);    // scale to fill
            double x = (w - scale*width)/2;
            double y = (h - scale*height)/2;
            AffineTransform at = AffineTransform.getScaleInstance(scale, scale);
            g2.translate(x, y);
            g2.drawRenderedImage(source, at);
            g2.dispose();
            return scaled;
        public static void main(String[] args)
            // create and configure your JFrame here...
            f.getContentPane().add(new JScrollPane(new ShowingImages()));
    }

  • How to display an image, which is stored in R3?

    Hi everyone,
    I need to display a image in a Web Dynpro application, this image is stored in SAP R3. Is there a FM to do that?
    Regards
    Eduardo Campos

    Hi Eduardo,
    if your image is in the system, there are the different syntax notations to retrieve it, as stated in the documentation link.
    To upload or download an image into an SAP system, just go to the MIME repository in the ABAP workbench, select an appropriate folder and do it. See http://help.sap.com/saphelp_nw2004s/helpdata/en/46/bb182fab4811d4968100a0c94260a5/frameset.htm and the sections on importing mimes and uploading and downloading mimes.
    Regards, Heidi

  • Display *.bmp images or *.tiff images

    Hi All,
    Need help in displaying *.bmp / *.tiff images at runtime.
    I am working in an application where the user may upload
    images (jsp) in any format (jpg/gif/png/bmp/tif) and I need to
    display these images from an user interface built in Flex with zoom
    effects. I am able to display jpg/gif/png using the standard Image
    control with zoom but unable to display the bmp and tiff files.
    Is there any way to display tiff and bmp files?
    Please help.
    Regards,
    Paromita

    All is well now. I used the Revo Uninstaller (www.revouninstaller.com) which scoured the registry and deleted dozens of left-behind pieces, then I reinstalled off the disk using all the default settings.

  • Need help in displaying an Image in a JLabel

    Hi everyone,
    I am using a JLabel to display images on a particular screen. I am facing some problem while doing so..
    On my screen there are images of some garments. When the users select colors from a particular list, i should color this garment images and load it on the screen again with the colors. I have a floodfill class for filling the colors in the images. The problem I am facing is I am able to color the image properly with my floodfill class but when displaying the image on the same jlabel, the image gets distorted somehow.
    Everytime I color the image, I create an ImageIcon of the image and use the seticon method from the JLabel class. First I set the icon to null and then set it to the imageicon created. here is the code I use.
    If 'image' is the the image i have to load
    ImageIcon imgicon = new ImageIcon(image);
    jlabel.setIcon(null);
    jlabel.setIcon(imgicon);I am setting the icon to null because I have not found any other method to clear the previous image from the jlabel.
    Can anyone who has worked on images before and faced a similar situation help me with this?? Is there some other container I can use besides the JLabel to display the images perhaps?
    Thanks in advance.....
    Bharat

    And the thing is when I first go into that screen with the selected colors it is displaying the images perfectly.
    It is only giving problems when I pick different colors on the screenit really sounds like the problem is in your floodfill class.
    I have no idea what's in floodfill, but if you were e.g. using a JPanel and paintComponent,
    you would need to have as the first line in paintComponent()
    super.paintComponent(..);
    to clear the previous painting.
    if not, you would be just drawing over the top of the previous paintComponent(), and if the calculation of the
    painting area is not 100% exact, you may get the odd pixel not painted-over, meaning those pixels will display
    the old color.

  • I've just bought a Macbook Pro 15" and I'm trying to use Photoshop, but the resolution its displaying the images at for 100% are too small. I have to design for the web, so need to be intricate with detail, but I'm finding it adjusts the resolution of the

    I've just bought a Macbook Pro 15" and I'm trying to use Photoshop, but the resolution its displaying the images at for 100% are too small. I have to design for the web, so need to be intricate with detail, but I'm finding it adjusts the resolution of the image right down. (I mean you can see the image clearly, but it's too small to edit). When I look at Safari and see a web page at 100% it's clear, but the same page displayed in Photoshop CC appears 50% of the size (even though it says it's 100%)   If I move the application window to another screen it adjusts it correctly  – leaving all the pallettes, menus and tools correctly sized as they are on the retina display   Is there some way to adjust the way Photoshop CC displays images so it is more consistent with what you actually see?   There doesn't seem to be any answer on the Adobe forum, so hopefully someone here can shed some light.  MacBook Pro with Retina display, 15", OS X Yosemite (10.10.2), Photoshop CC 2014

    I tested both ways. With "open in low resolution" ckecked the size of the images is cool, but it is low-resolution including Photoshop appearance.
    If "open in low resolution" is unckecked the appearance is good but the very small size.
    See the image below. It has 650 x 732 px, 72 dpi. The font of the text "Neste aniversário ..." is with 18pt.

  • Need help displaying images with List component for Flash CS4 (ActionScript 3.0)

    Hi folks:
    I am an inexperienced user of Flash CS4 Pro (v10.0.2). I am attempting to use the List component with ActionScript 3.0 to make a different image display when a user clicks each item in a list.
    I did find a tutorial that showed me how to make different text display using a dynamic text box and the following ActionScript:
    MyList.addEventListener(Event.CHANGE, ShowSelectedItem);
    function ShowSelectedItem(event:Event):void {
        ListText.text=MyList.selectedItem.data;
    ...where My List is the instance of the List component and ListText is the dynamix text box. In this case, the user clicks an item in the list, defined by the label value in the dataProvider parameter of the List component, and text displays as defined in the data value in the dataProvider parameter.
    However, as I mentioned to start, what I really want to do is make images display instead of text. Can anyone provide me the steps to do this?
    I appreciate your help (in advance)!!
    Cindy

    Hi...thanks for responding! I was planning on using images from the Library, but if there is a better way to do it, I'm open. So far, I just have text in the data property. This is part of my problem. I don't know what I need to put in the data value for an image to display. Do I just put the image file name and Flash will know to pull it from the Library? Do I need to place the images on the stage on different frames? I apologize for the "stupid user" questions, but as you can tell, I'm a newbie.
    Appreciate your patience and any help you can offer!
    Cindy

  • I bought an Ipod touch Used, I connected to my PC and I wanted to restore it, but the restoration could not be completed, since my PC does not recognize my iPod or iTunes. On the iPod screen displays an image that says I need to connect the device to iTun

    I bought an Ipod touch Used, I connected to my PC and I wanted to restore it, but the restoration could not be completed, since my PC does not recognize my iPod or iTunes. On the iPod screen displays an image thatsays I need to connect the device to iTunes.

    http://support.apple.com/kb/TS1538
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

  • I need to create a image using some numeric values and i want to display values in image,

    I need to create a image using some numeric values and i want to display values in image, Numeric values be enterd by text file, excel file or user input by dialog box,
    this is the sample if image.
    http://s17.postimg.org/5xvtzbztn/5_01_03_I.png
    128 x 16 Pixels , Back ground Black, Numbers in Red, Should be same as above picture.
    Because i have hundreds of images to create like this.
    If any one can make a script for this it is very good.
    Sorry about my English.
    Thank you.

    Have you checked out data driven graphics?
    https://helpx.adobe.com/photoshop/using/creating-data-driven-graphics.html

  • Need help displaying image on canvas  :((

    can anybody help me with my coding. my problem is, i cannot display an image on my canvas. plz..someone help me to solve my problem..
    Here's my coding...
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    import java.util.*;
    public class ImageMidletServlet
        Display display = null;
        //Form f = null;
        String url = "http://localhost:8080/banner/hp0.gif";
        String url2 = "http://localhost:8080/banner/rotateNumber";      
        //String url = "http://localhost:8080/banner/banner";
        Command backCommand = new Command("Back", Command.BACK, 0);
        Command submitCommand = new Command("Submit", Command.OK, 2);
        Command exitCommand = new Command("Exit", Command.STOP, 3);
        private Test test;  
        private StringItem stringItem2;
        private TextField txtField;
        private Timer tm;          // Timer
        private load load;       // Task
        private int id = 0;
        Image img = null;
        //String id;
        public ImageMidletServlet(Display display)
            this.display=display;  
            loadimage();
        public void loadimage()
            tm = new Timer();
            load = new load();
            tm.schedule(load,0,6000);
         class Test extends Canvas implements Runnable, CommandListener
            private Canvas canvas;
            public Test(Canvas canvas)
                this.canvas=canvas;
                setCommandListener(this);
            public void start()
                Thread t = new Thread(this);
                t.start();
            public void run ()
                DataInputStream is = null;
                DataInputStream is2 = null;
                StringBuffer sb = new StringBuffer();
                Image img= null;
                TextBox txtBox = null;
                StringBuffer b = new StringBuffer();
                HttpConnection c2 = null;
                OutputStream os = null;           
                ++ id;
                try
                    c2 = (HttpConnection)Connector.open(url2+ "?bannerid="+id);
                    os = c2.openOutputStream();
                    os.write(("bannerid="+id).getBytes());              
                    os.flush();
                    //HttpConnection c = (HttpConnection) Connector.open(url+ "?bannerid="+id);
                    HttpConnection c = (HttpConnection) Connector.open(url);
                    int len = (int)c.getLength();
                    if (len > 0)
                        is = c.openDataInputStream();
                        byte[] data = new byte[len];
                        is.readFully(data);
                        is2 = c2.openDataInputStream();
                        int ch;
                        while ((ch = is2.read()) != -1) {
                        b.append((char) ch);
                        System.out.print((char)ch);
                        try {
                        //img = Image.createImage(data, 0, len);
                        img = Image.createImage("/images/splash.png");
                        Graphics graphics = img.getGraphics();                   
                        catch (Exception e)
                        if(img==null)
                        System.out.print("no image");
                        else {System.out.print("got image");}
                    else
                        showAlert("length is null");;
                    is.close();
                    c.close();
                    c2.close();
                   // repaint();
                catch (Exception e)
                    e.printStackTrace();
                    showAlert(e.getMessage());
            /* Display Error On screen*/
            private void showAlert(String err)
                Alert a = new Alert("");
                a.setString(err);
                a.setTimeout(Alert.FOREVER);
                display.setCurrent(a);
             public void commandAction(Command c, Displayable d)
            if (c == exitCommand)
                //destroyApp(true);
                //notifyDestroyed();
            else if (c == backCommand)
                //display.setCurrent(f);
            else if (c == submitCommand)
                /*test  = new Test(this);
                test.start();*/
             protected void paint(Graphics graphics)
             if (img != null)
                graphics.setColor(0x000000);  
                graphics.drawImage(img, 0, 0, Graphics.TOP | Graphics.HCENTER);
             else
             {System.out.print("no drawing");}
        class load extends TimerTask
        private Test canvas;
           public final void run()
          this.canvas = canvas;
          test  = new Test(canvas);
          //test();
          test.start();
    }

    Hi
    I would do like this: take the code that draws the image an put it into a separate class (which will extend the Canvas class) which will take as a parameter to its constructor either an array of bytes or an Image object (it's up to you) and call this class after you have downloaded all the bytes from the input stream. I presume that you get the "no drawing" message..
    Mihai

  • Display BLOB (image) column in (interactive) report

    Hi,
    I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
    i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
    i have also modified the BLOB display format as per
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    what i am missing is the correct query. if possible, i would like to control the size of the picture rendered within the report like say 40*50.
    I have also referred to the thread
    APEX 3.1 Display BLOB Image
    But i don't know how to place the
    dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
    in my query.
    The above also makes the report column as of type "number". is this expected?
    Any help would be much appreciated.
    Regards,
    Ramakrishnan

    You haven't actually said what the problem is?
    >
    I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
    i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
    i have also modified the BLOB display format as per
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    what i am missing is the correct query.
    I have also referred to the thread
    APEX 3.1 Display BLOB Image
    But i don't know how to place the
    dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
    >
    Something like:
    select
              name
            , description
            , dbms_lob.getlength(picture) picture
    from
              details
    if possible, i would like to control the size of the picture rendered within the report like say 40*50.For images close to this size it's easy to do this for declarative BLOB images in interactive reports using CSS. Add a style sheet with:
    .apexir_WORKSHEET_DATA td[headers="PICTURE"] img {
      display: block;
      width: 40px;
      border: 1px solid #999;
      padding: 4px;
      background: #f6f6f6;
    }where the <tt>PICTURE</tt> value in the attribute selector is the table header ID of the image column. Setting only one dimension (in this case the width) scales the image with the correct aspect ratio. (The border, padding and background properties are just eye candy...)
    However, scaling large images in the browser this way is a huge waste of bandwidth and produces poorer quality images than creating proper scaled down versions using image tools. For improved performance and image quality, and where you require image-specific scaling you can use the database ORDImage object to produce thumbnail and preview versions automatically, as described in this blog post.

  • How can I display three images in video rate succession (60 Hz)?

    For a structured illumination microscope application, I have developed a VI that creates three images and displays them in rapid succession (as fast as the loop will go) on a second monitor.
    From the naked eye it's pretty apparent that the loop is not displaying the images at video rate.  Is there a way (perhaps with some sort of buffer) to get them to display faster?  Is WinShow simply not going to be fast enough, and if not, what's an alternative method of displaying the images?  If it helps, the images need only be displayed once each (the loop was just for testing).
    Also, what is a way to measure the frame rate output of the images?
    (sorry for the sloppy code, new to LabView)
    Thanks,
    -T
    Attachments:
    illuminationpattern.vi ‏31 KB

    Hello,
    Why don't  you try drawing one window, call IMAQ WindShow once outside of the loop, then redraw that window each iteration within the loop.  Hopefully this stops the flutter of the window.  You can build a 3 element array of the 3 IMAQ images then use an index array to alternate through which image you want to be redrawn into the single window.  The constant calling of IMAQ WindShow seems messy.
    Regards,
    Isaac S.
    Applications Engineer
    National Instruments

Maybe you are looking for