Open and display image in MVC layout

Hello!
I cant figure out how I shall do this in an MVC layout:
The program request user to open an image file that are then displayed in a JLabel
My setup at the moment resolve in a nullpointerexeption because it dont get any actual image file, but I dont understand what I have missed.
I can not post the whole code fo you to run because it is to big, so I post the part that are the most important. please have a look.
PicturePanel
//Import Java library
import javax.swing.*;
import java.awt.*;
public class PicturePanel extends JPanel {
     //Variables
     private ImageIcon picture;
     //Method to get information of the selected file
     PicturePanel (String fileName) {
          picture = new ImageIcon (fileName); //Get the filename
          int w = picture.getIconWidth(); //Get the image with
          int h = picture.getIconHeight(); //Get the image height
          //Set preferable size for the image (Use the properties for the selected image)
          setPreferredSize(new Dimension(w, h));
          setMinimumSize(new Dimension(w, h));
          setMaximumSize(new Dimension(w, h));
     //Method to draw the selected image
     protected void paintComponent(Graphics g) {
          super.paintComponent(g); //We invoke super in order to: Paint the background, do custom painting.
          g.drawImage(picture.getImage(), 0, 0, this); //Draw the image at its natural state
}From my model:
//Local attributes
     boolean check = false; //Used to see if a statement is true or not
     PicturePanel pp;
     JFileChooser fc;
     int returnVal;
//newFile in File menu
     public void newFile() {
          //Open a file dialog in users home catalog
          fc = new JFileChooser();
          //In response to a button click:
          returnVal = fc.showOpenDialog(pp);
          System.out.println("You pressed new in file menu");
     }From my controler:
//User press "New" in File menu
          else if (user_action.equals("New")) {
               //Call method in model class
               model.newFile();
               //Update changes
               if (model.returnVal == JFileChooser.APPROVE_OPTION) {
                    System.out.println("Hello1");
                    File f = model.fc.getSelectedFile();
                    if (model.pp != null)     
                         model.pp = new PicturePanel(f.getAbsolutePath());
                    System.out.println("Hello2");
                    //Display image (Here is line 83)
                    view.setImage_DisplayArea(model.pp);
                    System.out.println("Hello3");
          }From my view:
//Sets the image to be displayed on the image_display area (Here is line 302)
     public void setImage_DisplayArea(PicturePanel pp) {
          image_display.add(pp);
     }The complet error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at java.awt.Container.addImpl(Container.java:1015)You pressed new in file menu
Hello1
Hello2
     at java.awt.Container.add(Container.java:351)
     at View_Inlupp2.setImage_DisplayArea(View_Inlupp2.java:302)
     at Control_Inlupp2.actionPerformed(Control_Inlupp2.java:83)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
     at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
     at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1050)
     at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119)
     at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1091)
     at java.awt.Component.processMouseEvent(Component.java:5602)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3129)
     at java.awt.Component.processEvent(Component.java:5367)
     at java.awt.Container.processEvent(Container.java:2010)
     at java.awt.Component.dispatchEventImpl(Component.java:4068)
     at java.awt.Container.dispatchEventImpl(Container.java:2068)
     at java.awt.Component.dispatchEvent(Component.java:3903)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
     at java.awt.Container.dispatchEventImpl(Container.java:2054)
     at java.awt.Window.dispatchEventImpl(Window.java:1801)
     at java.awt.Component.dispatchEvent(Component.java:3903)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)Edited by: onslow77 on Dec 16, 2009 5:00 PM
Edited by: onslow77 on Dec 16, 2009 5:04 PM

Hello again!
Anyone that can help me figure out how to implement this in an MVC layout, I feel stuck.
I post a little program that open and display an image file so that you better can understand what I whant to do.
ShowImage
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import javax.swing.filechooser.*;
public class ShowImage extends JFrame{
     //Variables
     JFileChooser fc = new JFileChooser();
     PicturePanel pp = null;
     ShowImage () {
          super("Show"); //Title
          //Create the GUI
          JPanel top = new JPanel();
          add(top, BorderLayout.NORTH);
          JButton openBtn = new JButton("Open");
          top.add(openBtn);
          openBtn.addActionListener(new Listner());
          //Settings for the GUI
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          pack();
          setVisible(true);
     class Listner implements ActionListener {
          public void actionPerformed(ActionEvent ave) {
               int answer = fc.showOpenDialog(ShowImage.this);
               if (answer == JFileChooser.APPROVE_OPTION){
                    File f = fc.getSelectedFile();
                    //Check
                    System.out.println(f);
                    System.out.println(pp);
                    if (pp != null)
                         remove(pp); //Clean so that we can open another image
                    //Check
                    System.out.println(pp);
                    //Set the PicturePanel
                    pp = new PicturePanel(f.getAbsolutePath());
                    //Check
                    System.out.println(pp);
                    //Add PicturePanel to frame
                    add(pp, BorderLayout.CENTER);
                    validate();
                    pack();
                    repaint();
     //Main
     public static void main(String[] args) {
          new ShowImage();
}PicturePanel
//Import Java library
import javax.swing.*;
import java.awt.*;
public class PicturePanel extends JPanel {
     //Variables
     private ImageIcon picture;
     //Method to get information of the selected file
     PicturePanel (String fileName) {
          picture = new ImageIcon (fileName); //Get the filename
          int w = picture.getIconWidth(); //Get the image with
          int h = picture.getIconHeight(); //Get the image height
          //Set preferable size for the image (Use the properties for the selected image)
          setPreferredSize(new Dimension(w, h));
          setMinimumSize(new Dimension(w, h));
          setMaximumSize(new Dimension(w, h));
     //Method to draw the selected image
     protected void paintComponent(Graphics g) {
          super.paintComponent(g); //We invoke super in order to: Paint the background, do custom painting.
          g.drawImage(picture.getImage(), 0, 0, this); //Draw the image at its natural state
}//The endEdited by: onslow77 on Dec 16, 2009 7:30 PM

Similar Messages

  • Upload and display image in webside

    Hello Friends,
    I am developing an auction web site ,and facing some problem so I need your help.
    There is some confusion about uploading and displaying images in website .In web based
    application if I want to upload images than where have to store the images database or server
    side any folder .I have not idea about that please send your ideas and sussesions.
    Second problem is What is the best way to display images in webside either giving a direct
    path of server side image folder or I need to retrieve all images from database .
    I have no idea about it please send me your guideline which are usefull for me to implement in my
    website.
    what is the correct way to upload and display images in website ?
    Thanks . Have a nice day.

    If you are using a Container you just leave your image files in the home directory of your web application. And forget this idea about database. It´s not necessary in this case.
    To display the images just use HTML, <img src="url">.

  • How to decode a set of datas received from serial port and display image on a canvas based on CVI ?

    Hi !
    I have received a set of datas via rs232 and it contains picture messages. I have to decode the datas first and then display them on a canvas.
    I have known several functions that may be used . Such as
    int SetBitmapData (int bitmapID, int bytesPerRow, int pixelDepth, int colorTable[], unsigned char bits[], unsigned char mask[]);
    int CanvasDrawBitmap (int panelHandle, int controlID, int bitmapID, Rect sourceRectangle, Rect destinationRectangle);
     However,I don't know how to set the following parameters according to the actual pixel values and color values.
    int bytesPerRow, int pixelDepth, int colorTable[], unsigned char bits[], unsigned char mask[]
     What's more,I have no idea how to decode the datas.
    The  attachment is a incomplete project. I will be very appreciated if anyone could help me .
    Best regards.
    xiepei
    I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
    Attachments:
    Decode and display image.zip ‏212 KB

    Well, things are getting a bit clearer now.
    1. Your image is actually 240x240 pixel (not 320x240 as you told before). The size of image data is 57600 bytes which corresponds to that frmat (I was puzzled by such a data size compared with larger image dimensions!)
    2. The image is a 8-bits-per-pixel one; this means that you must provide a color palette to create the bitmap
    3. You cannot simply copy image data into bitmap fields in CVI: CreateBitmap always produce an image with pixeldepth matched with display colour depth (normally 24 or 32 bpp)
    All that means that you must:
    1. Create the appropriate color palette with 256 colors: it may be a grayscale or color palette depending on camera characteristics. Grayscale palette can be found in my sample project, while sample colour palettes can be found here (here the description of a "standard" 8-bpp color palette)
    2. Create the bits array correctly dimensioned for the color depth of your monitor
    3. Get each pixel value from the camera, lookup in the color palette for the appropriate colour and create the RGB informations into the bits array in memory
    4. Display the bitmap on the canvas
    As a first step, I would configure my system for 256-color display setting, create a bitmap and simply copy image data into it: you should be able to get the correct image back to your screen.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • When i attach a portable pdf to an email, it opens and displays contents.  I want the file to remain closed - help.  thanks

    When I attempt to attach a portable pdf to an email, it automatically opens and displays in the email.  I want the file to be attached not opened.  I am new to MAC and do not understand this portable pdf concept.  Lease help.  all I want is a file to show on the email message which can be opened by the person receiving the email.

    Mail shows any single-page PDF (as well as many other document types) as a preview in an email message rather than the icon, but it is actually being attached as a normal email attachment. Unless the recipient also has Mac OS X Mail, they'll just see the PDF as an attachment unless their mail application also shows PDFs in line.
    There is a third-party product which can suppress this display so that all attachments including single-page documents just show in Mail as an icon. If that's of interest, let me know and I'll post the URL to the product. But it doesn't affect how the document is attached and the email sent, only how it displays on your system.
    Regards.

  • Efficiency of decoding and displaying image files?

    BRIEF SUMMARY
    My question is this: can Flash Player download JPG and GIF
    files from a server and rapidly open/decode them, ready for
    display, efficiently and
    entirely 'in memory'?
    Would Flex be a good choice of language for developing a RIA
    that needs to continually download lots of JPG and GIF images
    on-the-fly from the server and render them on the screen? I *don't*
    want my application to thrash the hard disc.
    BACKGROUND
    I am designing a 'rich' web app, and I'm investigating
    whether Flex is the right tool for the job.
    Although Flash's animation features are an obvious selling
    point for implementing my user interface, I also need to do some
    server-side rendering. What I want to do is perhaps a little
    unorthodox: I will be generating lots of GIF and JPG files on the
    fly and these will be streamed to the client (along with other
    application data, e.g. in XML format) to update different parts of
    the on-screen document. In need this to happen very quickly (in
    some cases, creating the effect of animation).
    It happens that JPGs and 16-colour GIFs will be, by far, the
    most efficient formats for streaming the images, because of the
    nature of the application. I could of course send the images in
    some proprietary format, geared for my application, but presumably
    decoding the images would be slow as I would have to implement this
    myself in ActionScript, and so I would be limited by the speed of
    Flex 'bytecode'. (I realise Flash is a lot more optimised than it
    once was, but I am hoping to see a gain from using image formats
    that Flash natively understands!)
    Naturally the internet bandwidth should (in principle) be the
    bottleneck. However, assuming I can get my image files to the
    client on time, want I want to know is:
    how efficient is Flash at loading such files?
    Bearing in mind that I'm not just displaying the occasional
    image -- I will be doing this continuously. Most of the images
    won't be huge, but there will be several separate images per
    second.
    The image files will be a mixture of normal colour JPGs and
    4-bit colour GIFs (LZW-compressed). I know that Flash natively
    supports these formats, but depending on how Adobe have implemented
    their LZW/Huffman decoding and so on, and how much overhead there
    is in opening/processing downloaded image files before they are
    ready to 'blit' to the screen, I imagine this could be pretty fast
    or pretty slow!
    If my client only has a modest PC, I don't want the JPG/GIF
    decoding alone to be thrashing his CPU (or indeed the disc) before
    I've even got started on 'Flashy' vector stuff.
    I'm new to Flash, so are there any 'gotchas' I need to know
    about?
    E.g. Would it be fair to assume Flash Player will do the
    decoding of the downloaded image entirely 'in memory' without
    trying to do anything clever like caching the file to disc, or
    calling any libraries which might slow down the whole process? It
    would be no good at all if the images were first written to the
    client's hard disc before being ready to display, for example.
    Further, if I'm doing something a little out-of-the-ordinary,
    and there is no 'guarantee' that images will be loaded quickly,
    what I'm doing might be a bad idea if a later version of Flash
    Player may (for example) suddenly start doing some disc access in
    the process of opening a newly downloaded image. So, while I could
    just 'try it and see', what I really need is some assurance that
    what I'm doing is sensible and is likely to carry on working in
    future.
    Finally, I imagine JPG/GIF decoding could be something that
    would vary from platform to platform (e.g. for the sake of
    argument, Flash Player for Windows could use a highly-optimised
    library, but other versions could be very inefficient).
    This could be the 'make or break' of my application, so all
    advice is welcome! :) Thanks in advance.

    You need a servlet/jsf component to render the image in the response.
    Look at this: http://www.irian.at/myfaces-sandbox/graphicImageDynamic.jsf

  • Help, how to open and display blobs from tables

    Dear all,
    I am trying to store ms-word files on a table using a blob column.
    Does anyone how to open the files and display them from a form using 9iAS?
    Thank you.
    Carlos.

    And there may be, but you won't likely find that here. Do some time searching Google and maybe you'll find code that someone was nice enough to make freely available, although I wouldn't count on it. Were i a programmer and took the time to read those docs and write the code, I'd want to be paid for my time. But there are a lot of programmers who swear by freeware! You may get lucky.

  • 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

  • File name and displaying images

    I am trying to rename all the jpg files i have in my directory, to consecutive number. eg. 1.jpg, 2.jpg. as a new comer to the java world, im not too sure if i have doen it right. could you check...
    Also, after i renamed the files i want the images displayed side by side across the screen..
    This is teh code...
    import java.awt.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.io.*;
    import java.io.File;
    import java.io.IOException;
    public class GetImages extends Applet {
         public static void main(String[] args) throws IOException
    // File (or directory) with old name
        File file = new File("picture1.jpg");
        // File (or directory) with new name
        File file2 = new File("1.jpg");
        // Rename file (or directory)
              int xx;
              xx = 0;
       if (xx<500) {
       file.renameTo(new File(xx+".jpg"));
         xx++;
    private Image image;
    public void init() {
       image = getImage(getDocumentBase(), (xx+".jpg"));
    public void paint(Graphics g) {
         int x, y, counter, numberOfImages;
    x = 0;
    y = 0;
    counter = 1;
    numberOfImages = 21;
    while (counter != numberOfImages) {
              g.drawImage(image, x, y, 15, 15,this);
              x = x + 15;
              counter++; im not too sure where i am goign wrong?

    You're really trying to do two things: rename the files and display the images. Let's work on one at a time. First, to rename the files, you'll need to get a list of the files in the directory. Look at the Javadocs for java.io.File (http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html) for the way to do this.
    Once you have the list of files, you need to loop through them and rename each one. A for loop will be a good way to do this. You'll have an array of Files, so your code might look something like this:
    // Get your array of Files and call it something simple like 'files'
    int numFiles = files.length;
    for( int x = 0; x < numFiles; x++ )
    // Rename the file
    }The for loop will start at 0 and loop until x is equal to numFiles.

  • Store and Display Image from Database

    Now that MySQL is working (woo hoo!) with JSC, I have a couple of questions for any experts out there...
    1. How would I perform an image or other file upload from a browser?
    2. How would I retrieve and display an image from a db on a jsp page?
    Thanks for any help.

    Craig, I think I have a simpler way to load an image on the page, although for the time being I'm not retrieving from a database, but from the file system. The problem is that I'm not getting the pages to load continuously with new images. At some point it apears that the session gets clogges and can not load new pictures. I'll try to include the page bean code just below. This time I'm not adding the "code" tags because I haven't being successful with that. If you have problems , please, contact me at [email protected].
    The core of the code is in a couple of button_action methods.
    If you need, I can give access to the http server where this is running.
    Luiz
    package untitled;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.std.*;
    import javax.faces.component.*;
    import javax.swing.filechooser.*;
    import javax.swing.*;
    import java.io.*;
    * Creator-managed class.
    * Your code should be placed at the end.
    public class Page1 extends AbstractPageBean {
    private HtmlForm form1 = new HtmlForm();
    private FileSystemView filesystem = FileSystemView.getFileSystemView();
    private File path = new File("C:/Documents and Settings/Luiz Costa/My Documents/Creator/Projects/PictureAlbum/build/images/Isadora\'s Wedding");
    private File[] fileslist = filesystem.getFiles(path, false);
    private int counter = 1;
    private int iw = 0;
    private int ih = 0;
    private Integer aiw = new Integer("1");
    private float aar = 0;
    private float ar = 0;
    private ImageIcon ii = null;
    public HtmlForm getForm1() {
    return form1;
    public void setForm1(HtmlForm hf) {
    this.form1 = hf;
    private HtmlGraphicImage image1 = new HtmlGraphicImage();
    public HtmlGraphicImage getImage1() {
    return image1;
    public void setImage1(HtmlGraphicImage hgi) {
    this.image1 = hgi;
    private HtmlCommandButton button1 = new HtmlCommandButton();
    public HtmlCommandButton getButton1() {
    return button1;
    public void setButton1(HtmlCommandButton hcb) {
    this.button1 = hcb;
    private HtmlCommandButton button2 = new HtmlCommandButton();
    public HtmlCommandButton getButton2() {
    return button2;
    public void setButton2(HtmlCommandButton hcb) {
    this.button2 = hcb;
    private HtmlGraphicImage image2 = new HtmlGraphicImage();
    public HtmlGraphicImage getImage2() {
    return image2;
    public void setImage2(HtmlGraphicImage hgi) {
    this.image2 = hgi;
    private HtmlOutputText outputText1 = new HtmlOutputText();
    public HtmlOutputText getOutputText1() {
    return outputText1;
    public void setOutputText1(HtmlOutputText hot) {
    this.outputText1 = hot;
    * This constructor contains Creator-managed initialization code.
    * Your initialization code can be placed at the end,
    * but, this code will be invoked only the first time the page is rendered,
    * and any properties set in the .jsp file will override settings here.
    public Page1() {
    // Creator-managed initialization code
    try {
    catch ( Exception e) {
    log("Page1 Initialization Failure", e);
    throw new FacesException(e);
    // User provided initialization code
    public String button1_action() {
    // Add your event code here...
    outputText1.setValue(fileslist[counter].getAbsoluteFile().getPath()+fileslist.length+"left"+counter);
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image1.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image1.setHeight(""+(int)aar);
    outputText1.setValue(image1.getHeight());
    image1.setUrl("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image2.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image2.setHeight(""+(int)aar);
    outputText1.setValue(image2.getHeight());
    image2.setUrl("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    counter = (counter-1+fileslist.length) % fileslist.length;
    return null;
    public String button2_action() {
    // Add your event code here...
    outputText1.setValue(fileslist[counter].getAbsoluteFile().getPath()+fileslist.length+"right"+counter);
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image1.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image1.setHeight(""+(int)aar);
    outputText1.setValue(image1.getHeight());
    image1.setUrl("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image2.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image2.setHeight(""+(int)aar);
    outputText1.setValue(image2.getHeight());
    image2.setUrl("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    counter = (counter+1+fileslist.length) % fileslist.length;
    return null;
    }

  • Loading And Displaying image From MYSQL

    Hello, How can I load and display picture stored into a MYSQL database in a Swing GUI using for example JLable component.

    establish a connection to ur sql, n
    retireve the record with the images or image url in the db.
    and then load it to a Image icon and set it to a JLabel.

  • Insert and display images in a report

    Hi ABAPers, I need to insert and display an image (bitmap format) in a standard ABAP report. With the consideration that the image (an employee photograph) could vary depending on the employee numer the user enter as an input parameter for the report. Any ideas of how can I do it? Help will be appreciated. Thanks in advance.
    Regards.
    Sebastian.

    No you can’t do it as Vashmi already said so , you can upload the pictures in ALV, but  in your requirement I must say you should see the OSS note # 353949
    <b>FYI</b>
    Symptom
    In the following note you will find some of the most frequently asked questions and their answers. Most answers are release independent, but some are valid for release 4.6 only.
    Other terms
    Questions, picture in header, profile, FAQ
    Solution
    [1] Question: Is it possible to configure the profile e.g. for a                   person?
    [2] Question: How can I bring a picture of the person into the                   profile header?
    [1] Question: Is it possible to configure the profile e.g. for a                   person?
    Answer: It is possible to add or delete sub-profiles. You can do this in the customizing (transaction OOPF). There you can deactivate sub-profiles for an object type. Or add a new existing sub-profile.
    <b>[2] Question: How can I bring a picture of the person into the                   profile header?
    Answer:
    You should have an employees picture with format JPG or BMP...
    Start transaction OAAD to add the picture to SAP ArchiveLink. Press the Create-Button there. You have to type in PREL for the Business object and HRICOLFOTO for the Document type. Then press create. On the popup you must maintain the wished Personnel number for that the picture should be valid. Then press 'Continue'. Choose the picture and continue.
    For the screen header 00 (if it isn't changed) you should see the picture in the profile.</b>
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Knowledge comes but wisdom lingers!!"

  • Rotate TV 90 degrees and display images properly?

    I would like to rotate our LG HDTV to Vertical orientation (not the traditional horizontal orientation), and display the images from an Apple TV in the vertical orientation. Is this possible? I know that I can rotate images on my MacPro monitor (Cinema display) by 90, 180, or 270 degrees. This is the sort of control I would like from an Apple TV when output to the Vertical standing HDTV.

    While you could easily turn the Tv and have any Portrait photos rotated landscape to view on a tv in portrait mode, AppleTV itself will not natively support display rotation - the photos properly tagged would show ok but menu would be all wrong and not rotated. You'd be better using a Mac Mini or other computer that allowed display rotation - use a DVI to HDMI adapter.

  • Load and display image using CDC

    Hi everyone,
    Please help. I'm new to java. I need a simple routine to load and display an image from the file system into a CDC app on windows mobile 5. I'm usin creme 4.1.
    Thanx in advance

    Use the following as a guide:
    1. Get the image (path below must be absolute):
    public static Image getImage(String filename) throws ScanException {
    Image img = null;
    // Read paths from properties file
    StringBuffer buf = new StringBuffer("\\");
    buf.append(ScanUtility.getPathImages());
    buf.append("\\");
    buf.append(filename);
    buf.append(".jpg");
    File dataFile = new File(buf.toString());
    if(!dataFile.exists())
    throw new ScanException("Cannot locate the file:\n" + dataFile.getAbsolutePath());
    img = Toolkit.getDefaultToolkit().createImage(buf.toString());
    return img;
    2. Create a class to display the image (pass in the image, above):
    ImagePanel class source:
    import java.awt.*;
    import java.awt.image.*;
    public class ImagePanel extends Panel {
    private Image image = null;
    private Image scaledImage = null;
    private boolean imageComplete = false;
    public ImagePanel(Image img) {
    image = img;
    scaledImage = image.getScaledInstance(200, -1, Image.SCALE_DEFAULT);
    prepareImage(scaledImage, this);
    // Override the paint method, to render the image
    public void paint(Graphics g) {
    if(imageComplete) {
    g.drawImage(scaledImage, 0, 0, this);
    // Override imageUpdate method, to prevent repaint() from trying
    // to do anything until the image is scaled
    public boolean imageUpdate(Image img, int infoFlags, int x, int y, int w, int h) {
    if(infoFlags == ImageObserver.ALLBITS) {
    imageComplete = true;
    repaint();
    return super.imageUpdate(img, infoFlags, x, y, w, h);
    public void flush() {
    image.flush();
    scaledImage.flush();
    image = null;
    scaledImage = null;
    }

  • How much time an LCD screen can stay on and displaying images?

    Suppose I'm rendering on the new '27 iMac, how much time the LCD screen can stay on and displaying the same image? (Like the desktop, or a very slow progress bar).
    And, if there is a difference, how much time it can stay simply on and showing differents images?
    I have to use a screen saver? (but it consume some power to the rendering) If yes, after how much time? And what kind of screen saver, simply black screen or somethig animated?
    I have to turn off the display only? (but this can conflict with some particular software...) If yes, after how much time?
    Thanks.

    Suppose I'm rendering on the new '27 iMac, how much time the LCD screen can stay on and displaying the same image? (Like the desktop, or a very slow progress bar).
    And, if there is a difference, how much time it can stay simply on and showing differents images?
    I have to use a screen saver? (but it consume some power to the rendering) If yes, after how much time? And what kind of screen saver, simply black screen or somethig animated?
    I have to turn off the display only? (but this can conflict with some particular software...) If yes, after how much time?
    Thanks.

  • Upload and display images

    Can anybody tell me how to display images. Iam unable to create procedures. I dont know what codes to be used. Can anybody tell me the step by step procedure. my id is [email protected]

    What format are the images in?
    Do they meet the pixel resolution and size requirments of where your uploading them?
    Apple screenshots are in png format, you may have to use Preview to convert png to the more popular jpg format for uploading.
    We need more details, where are you trying to upload? etc. etc.

Maybe you are looking for