Trying to display image in jscrollpane

Hi,
I am trying to get an image to display in a JScrollPane. The image is bigger than the allotted size so scrollbars are set to appear. The scrollbars appear and are scrollable but the image is not there. I know there have been other posts regarding this and I have tried the suggestions in those but nothing has worked. Here's a snipet of my code:
JLabel photo = new JLabel(new ImageIcon("/images/sbc.jpg"));
JPanel photoPanel = new JPanel();
JScrollPane photoScrollPane = new JScrollPane();
String filename = "images/sbc.jpg"
final URL url = View.class.getResource("/" + filename);
image = Toolkit.getDefaultToolkit().getImage(url);
photoPanel.add(photo);
photoPanel.setPreferredSize(new Dimension(imageWidth,imageHeight));
photoPanel.setVisible(true);
photoScrollPane.setPreferredSize(new Dimension(imageWidth,imageHeight));
//photoScrollPane.getViewport().add(photoPanel);
photoScrollPane.setViewportView(photoPanel);
photoScrollPane.setVisible(true);
this.setLeftComponent(photoScrollPane);
this.setVisible(true);
}this is a JSplitPane object and is inside a JFrame.
In this version of my code, I created the JScrollPane with the default constructor and not new JScrollPane(photoPanel); but it didn't make any difference.
I have also overridden the paintComponent method:
    public void paintComponent(Graphics g) {
        System.out.println("Entered View2.paintComponent()");
        g.drawImage(image,0,0,this);
        //g.drawImage(((ImageIcon)photo.getIcon()).getImage(),0,0,this); - doesn't work
        System.out.println("Exiting View2.paintComponent()");
    }I think if i told this object to add photo(JLabel) or photoPanel(JPanel) instead, the top left corner of the image is displayed in the designated area with no scroll bars.
Thanks in advance!

I'm guessing you don't need the leading "/" in the path name. If that doesn't fix your problem then read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html]How to Use Icons for working examples.

Similar Messages

  • "Invalid byte 1 of 1-byte UTF-8 sequence" exception trying to display image

    Hi there!
    Last night I updated my project to open the <wellcome-file>. So I put this in my web.xml file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id="WebApp_ID"
        version="2.5">
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.jspx</param-value>
    </context-param>
    <welcome-file-list>
        <welcome-file>faces/login.jspx</welcome-file>
    </welcome-file-list>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    [...]Now when I type http://localhost:8080/myproject the login.jspx is opened as expected.
    But after this change, exceptions started to shown when images from my template.jspx is loaded (?).
    Here's a piece of my template.jspx:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <jsp:root
         xmlns:jsp="http://java.sun.com/JSP/Page"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:r="http://richfaces.org/rich"
         xmlns:a4j="http://richfaces.org/a4j"
         version="2.0">
    <f:facet name="controls">
         <h:panelGroup>
              <h:graphicImage
                   value="../imagens/erro.png"
                   id="hidelink" />
         </h:panelGroup>
    </f:facet>
    [...]And here is the exception:
    SEVERE: Error Rendering View[/imagens/erro.png]
    com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
         at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.arrangeCapacity(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    [...]And, of course, the image is not displayed.
    The images from pages that uses template.jspx works fine (even the same image that causes the exception).
    Only images from my template.jspx and pages that I use with <ui:include> throws the exception.
    My directory structure:
    web
    |___templates
    |___imagens
    |___pages
    login.jspxI tried with ISO-8859-1 and UTF-8 as encoding and the problem is the same.
    I need some help. Any help.
    If any more info is needed, please just ask me.
    Thank you in advace!
    I'm using:
    JSF 1.2; Facelets 1.1.14; Richfaces 3.3; Tomcat 6, Java 6
    Yoshimit

    I got the same error. It was because my application's .java files were saved as UTF-8 but the .xhtml files were saved as cp1255 encoding. I have also added a filter to set the charset to each response like described [here |http://www.coderanch.com/t/211549/JSF/java/JSF-Character-Sets-UTF-mainly] .
    PS: I had another error after that which was caused by copying the Richfaces xmlns definitions from a PDf provided by Refcardz. The " symbol turend to something that the SAX parser could not process.
    Hope this helps.
    Pavel Myshkin

  • Trying to displaying image in screen.

    Hi,
    I'm new to this CLDC and MIDP coding. I'm working on this code right now, but I cannot seem to display a image in the screen. All I get is a blue background.
    Can someone help me to make the image appear in the screen?
    -I think it may have to do with the directories, but I am not sure. I have tried everything possible that I can think of.
    Here's my code:
    public class Character extends GameCanvas implements Runnable
        private Image image;
        private int xAxis_Image;
        private int yAxis_Image;
        public Character()
            super(true);
        public void gatherImageProperties()
            try
                image = Image.createImage("/example.gif");
            }catch(IOException e)
                System.out.println("e");
            finally{
                Thread thread = new Thread(this);
                thread.start();
        public void run()
            Graphics graphics = getGraphics();
            while(true)
                gameScreenRefresh(getGraphics());
                try{
                    Thread.currentThread().sleep(45);
                }catch(Exception e)
                    System.out.println(e);
        private void gameScreenRefresh(Graphics g)
            g.setColor(23, 200, 230);
            g.fillRect(0, 0, getWidth(), getHeight());
            g.drawImage(image, xAxis_Image, yAxis_Image, Graphics.HCENTER | Graphics.VCENTER );
            flushGraphics();
    }Here's my midlet
    public class my_Midlet extends MIDlet
        Character character;
        public my_Midlet()
        public void startApp()
            character = new Character();
            Display display = Display.getDisplay(this);
            character.gatherImageProperties();
            display.setCurrent(character);
        public void pauseApp()
        public void destroyApp(boolean unconditional)
    }

    image = Image.createImage("C:\Documents and Settings\Owner\Desktop\Graphics\src\graphic_Core\example.gif");{color:#000080}See the documentation for javax.microedition.lcdui.Image.createImage(String name){color}
    Creates an immutable image from decoded image data obtained from the named resource. The name parameter is a resource name as defined by Class.getResourceAsStream(name). The rules for resolving resource names are defined in the Application Resource Files section of the java.lang package documentation.
    {color:#000080}Refer to the documentation for java.lang{color}
    <h5>Application Resource Files</h5>
    Application resource files are accessed using getResourceAsStream(String name) in java.lang.Class . In the MIDP specification, getResourceAsStream is used to allow resource files to be retrieved from the MIDlet Suite's JAR file.
    Resource names refer to the contents of the MIDlet Suite JAR file. Absolute pathnames, beginning with "/" are fully qualified file names within the jar file.
    Relative pathnames, not beginning with "/" are relative to the class upon which getResourceAsStream is called. Relative names are converted to absolute by prepending a "/" followed by the fully qualified package with "." characters converted to "/" and a separator of "/". The resulting string is reduced to canonical form by applying as many times as possible the following:
    All occurences of "/./" are replaced with "/".
    All occurences of "/segment/../" are replaced with "/" where segment does not contain "/".
    The canonical resource name is the absolute pathname of the resource within the JAR.
    In no case can the path extend outside the JAR file, and resources outside the JAR file MUST NOT be accessible. For example, using "../../" does NOT point outside the JAR file. If there are any remaining "." or ".." characters they are treated literally in locating the resource. No resource can exist with that name so null is returned from Class.getResourceAsStream. Also, devices MUST NOT allow classfiles to be read from the JAR file as resources, but all other files MUST be accessible.
    {color:#000080}Place your image file in the jar, and use it from there.
    db{color}

  • I tried to display gif image from oracle to jsp but nothing appear

    i tried to display image from oracle DB to jsp directly without using file processing , and i used Servlet and jsp , Servlet to get image from DB and jsp to use <img> tag , when i Run Servlet code
    the image appaer on Microsoft Photo Editor , and when i run jsp the image dose not appear on jsp page , so please anyone has an idea about this broblem ,send the soluation or any information to my e-mail [email protected] , and I'll thankful about your help.
    the Servlet and jsp code are below .
    thank for your help
    Servlet:
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class Servlet extends HttpServlet
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    response.setContentType("image/gif");
    int id = Integer.parseInt(request.getParameter("no"));
    // int id = 2 ; when Run Servlet .
    ResultSet rs = null;
    Connection Lcon = null;
    String stmt = " select Image from ImageTable where lmage_id ="+id;
    Statement sm = null;
    String data1 ="";
    try
    Lcon = getConntcion();
    sm = Lcon.createStatement();
    rs = sm.executeQuery(stmt);
    if(rs.next())
    InputStream in = rs.getBinaryStream(1);
    ServletOutputStream sout = response.getOutputStream();
    int c;
    while((c=in.read())!= -1)
    sout.write(c);
    in.close();
    sout.flush();
    sout.close()
    }catch(Exception e)
    System.out.println("error in selectValue the error is "+e);
    finally
    rs .close( );
    sm .close( );
    Lcon.close( );
    public Connection getConntcion()
    Connection con = null;
    try{
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection(",,,,,,,, DB Info ,username and password ,,,,,,,,,,,");
    }catch(Exception e)
    System.out.println("error in connection the error is "+e);
    return con;
    Jsp code :
    <%@ page contentType="text/html"%>
    <html>
    <head
    </head>
    <title> testing image </title>
    <body>
    <form>
    <img src="servlet/Servlet?no=2">
    </form>
    </body>
    </html>

    InputStream in = rs.getBinaryStream(1);
    byte[] image= null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[8192];
    int bytesRead = 0;
    while ((bytesRead = in.read(buffer, 0, 8192)) != -1)
         baos.write(buffer, 0, bytesRead);
    image= baos.toByteArray();
    in.close();
    ServletOutputStream sout = response.getOutputStream();
    if (image != null)
           sout.write(image);
           sout.flush();
    }

  • IPhone 4 screen jumps around when displaying images.

    Hi guys,
    My iPhone 4 has randomly started behaving unusually when trying to display images. The problem is at it's worse when using the camera or trying to display photographs. The lighter the image, the worse the problem.
    The display seems to shrink and stretch rapidly from the bottom of the display. I also begin to see what should be the top of the screen appearing at the bottom.
    Any ideas what could cause it? The phone recently had a new screen fitted.
    Thanks in advance!
    Sean

    Here is a still of the screen... http://www.flickr.com/photos/43074185@N05/12239963166/

  • Displaying Image on the Emulator

    Hi all,
    I was trying to display image on to the emulator on canvas,problem is the image is getting failed to load.my code is as follows,and where should i have the image in my filesystem to be displayed on the emulator and what path should i give,my OS is LINUX
    try {
    image = Image.createImage("/212.png");
    } catch (IOException ex) {
    g.setColor(0xffffff);
    g.drawString("Failed to load image!", 0, 0, Graphics.TOP | Graphics.LEFT);
    return;
    when i try this it shows the exception:Failed to load image.
    Please Help me :-(..

    in = this.getClass().getResourceAsStream("/212.png");You are attempting to access the file in the root "/" folder. Something like:
    in = this.getClass().getResourceAsStream("212.png");or
    in = this.getClass().getResourceAsStream("res/212.png");or
    Image im = Image.createImage("212.png"); or
    Image im = Image.createImage("res/212.png"); should work.

  • Trying to display multipage tiff image getting error

    Hi
    I am trying to read multipage tiff image but dont know how
    I tried to display single page tiff getting error
    my code is
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Drawing;
    using System.Drawing.Imaging;
    namespace Documentviewer1
        public partial class _Default : System.Web.UI.Page
            //string filepath = "";
            protected void Page_Load(object sender, EventArgs e)
                //// filepath = "image\045237302.tif";
                string appath = Server.MapPath("/image") + @"\";
                string imagename = Request.QueryString["ImageFileName"];
                string filename = appath + imagename;
                Response.ContentType = "image/tiff";
                new Bitmap(filename).Save(Response.OutputStream, ImageFormat.Tiff);
                ////System.Drawing.Image TheImg = new App.Files.TIF(Request.QueryString["FilePath"]).GetTiffImageThumb(System.Convert.ToInt16(Request.QueryString["Pg"]), System.Convert.ToInt16(Request.QueryString["Height"]),
    System.Convert.ToInt16(Request.QueryString["Width"]));//getting error in thisline Parameter not valid
    my aspx page is has
    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
        CodeBehind="Default.aspx.cs" Inherits="Documentviewer1._Default" %>
    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <h2>
          <img alt="" src ="image/045237302.tif" width="200" height="200"/>
        </h2>
        <p>
            To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
        </p>
        <p>
            You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
                title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
        </p>
    </asp:Content>
    getting error as Parameter not valid.
    Can anybody help me to display the image in the browser.
    Thanks
    Mary Abraham
    Mary Sunish

    Hi MaryAbraham,
    Since the issue regards ASP.NET and website deployment. I suggestion you post the question in the ASP.NET forums at
    http://forums.asp.net/. It is appropriate and more experts will assist you.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Trying to Display the image

    Hi Steve/anyone
    I am trying to display the image upload and Display using the "Oracle Fusion Developer Guide" page 404 Working with Oracle Multimedia Types by Frank Nimphius and Lynn Munsinger. I tried to replicate the solution in a sample app. My upload works as said. But when i try to browse I dont see the image and i get the following error in the background. Please help. All the steps mentioned have been done
    ! Edit Images.jspx
    <af:inputFile value="#{bindings.Image.inputValue}" simple="true"
    id="if1">
    <binding:convertOrdDomain bindingRef="#{bindings.Image}"/>
    </af:inputFile>
    2 Browse Images.jspx
    <af:panelLabelAndMessage label="#{bindings.Image.hints.label}"
    id="plam1">
    <af:media contentType="#{bindings.Image.inputValue.media.mimeType}"
    source="#{bindings.Image.inputValue.source}" id="m2"/>
    </af:panelLabelAndMessage>
    <af:outputText value="#{bindings.Image.inputValue.media.width}" id="ot3"/>
    java.lang.NullPointerException
         at oracle.ord.html.OrdPlayMediaServlet.renderContent(OrdPlayMediaServlet.java:386)
         at oracle.ord.html.OrdPlayMediaServlet.deliver(OrdPlayMediaServlet.java:264)
         at oracle.ord.html.OrdPlayMediaServlet.doGet(OrdPlayMediaServlet.java:205)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFil

    Error showing images using Servlet OrdPlayMediaServlet

  • How to create a report in Form line Style and can display Image field?

    Hi,
    In Report builder 10g, I would like to create a Report with Form Line Style and this report included a Image field.
    I can choose this Style only when Select Report type is Paper Layout. Because, If I choose Create both Web & Paper Layout or Create Web Layout only then in the next Style tab 03 option Form, Form letter and Mailing Label be Disabled.
    But in Paper Layout, my report can not display Image field.
    I tried with Web layout and all the other Styles (Except 03 mentioned be Disabled) then all Styles are displayed Imager field OK.
    How to create a report in Form line Style and can display Image field?
    I was change File Format property of my Image field from text to Image already in Property Inspector. But report only showed MM for my Image field.
    Thanks & regards,
    BACH
    Message was edited by:
    bachnp

    Here you go..Just follow these steps blindly and you are done.
    1) Create a year prompt with presentation variable as pv_year
    2) Create a report say Mid report with year column selected 3 times
    - Put a filter of pv_year presentation variable on first year column with a default value say @{pv_year}{2008}
    - Rename the second time column say YEAR+1 and change the fx to CAST(TIME_DIM."YEAR" AS INT)+1
    - Rename the second time column say YEAR-1 and change the fx to CAST(TIME_DIM."YEAR" AS INT)-1
    Now when you will run Mid Report, this will give you a records with value as 2008 2009 2007
    3) Create your main report with criteria as Year and Measure col
    - Change the fx for year column as CAST(TIME_DIM."YEAR" AS INT)
    - Now put a filter on year column with Filter based on results of another request and select these:
    Relationship = greater than or equal to any
    Saved Request = Browse Mid Report
    Use values in Column = YEAR-1
    - Again,put a filter on year column with Filter based on results of another request and select these:
    Relationship = less than or equal to any
    Saved Request = Browse Mid Report (incase it doesn't allow you to select then select any other request first and then select Mid Report)
    Use values in Column = YEAR+1
    This will select Year > = 2007 AND Year < = 2009. Hence the results will be for year 2007,2008,2009
    This will 100% work...
    http://i56.tinypic.com/wqosgw.jpg
    Cheers

  • Problem Displaying Images in a JFrame

    I am writing a program that displays images on a JFrame window. I have been reading the other postings about this topic however I have not been able to make my code work. I am hoping there is some obvious solution that I am not noticing. Please help, I am very confused!
    public class WelcomeWindow {
    private JLabel label;
    private ImageIcon logo;
    public WelcomeWindow() {
    label = new JLabel();
    logo = new ImageIcon("/images/logo.gif");
    label.setIcon(logo);
    this.getContentPane().add(label);

    Instead of a JLabel, have you tried to use a JButton containing the Icon?
    Also (but I think you've done it already), you could do that :
    File iconFile = new File("/images/logo.gif");
    if (!iconFile.isFile()) {
    System.out.println("Not a file");
    That way you'll be certain that the path given is correct.
    Hope this helps.

  • No data found when display image in report

    Hi,
    I have a table with a blob field in it which I use to store some image (gif),
    I tried to display the image in report but follow the guideline in http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/advnc_blob.htm#BCGBCHBD
    but when I run the report, error
    "report error:
    ORA-01403: no data found"
    prompt, I do not have MIME,FILENAME column in the table, so I define only
    IMAGE,Table Name,Column containing BLOB,Primary Key Column 1 and Primary Key Column 2 in the report column.
    Anyone has also this problem?
    Thanks
    Pek

    Hi,
    I found that the problem is there when I select the option
    "Use Generic Column Names (parse query at runtime only)" in the report.
    Is this a bug?
    Rgds
    Pek

  • Display image in detail groups in jheadstart 11.1.1.3.35

    Hi, I've been trying to make a project that should display one picture in one of the detail groups. but when i generate the jheadstart definition editor and run the project, it shows an empty box for the image (image is not loaded).
    I've seen the source code and every thing seems right and when i use that detail group as a master group the image display just fine.
    is jheadstart 11g have a problem for displaying image in detail groups? because I've heard this option works in 10g pretty fine.
    please help me how i can fix this problem and i have to say my project deadline is coming :(

    We are not aware of such a problem.
    To really check whether it is related to a detail group, can you temporarily make the detail group a top-level group, generate and run your application to see whether the problem goes away?
    Make sure you first uncheck the Same Page checkbox before you drag and drop the detail group to become a top group.
    There is a known ADF issue that when you upload a new image, the new image is only shown when you restart the session.
    Steven Davelaar,
    JHeadstart Team.

  • Display Image in Report

    Hi,
    I want to display image link in one of the columns in report.
    ex: if i click that image it should go to google maps.
    I stored the image in /res/s_protal/image.jpg and also in oc4j.
    I know to fmap to show it only once.
    but i want to reflect it in all the rows of a column.
    Things i tried:
    Stored in the same machine took the ip addres and prot and given as below it was working.
    But if i move it to other machines then it getting failed so again i want to update the machine ip.
    http://225.225.225.225:9704/analytics/res/s_proact/images/images.jpg
    Is there any possible way to give some common syntax so that the corresponding machine ip will be pointed once the
    report moved to different machines.
    Thanks,
    satheesh

    Hi Santeesh,
    I just saw your post and I thought I'd ask you with my query:
    I want to add some pop-up info on some of the data when the user hover on it. have you
    got a clue what do I need to do for that?
    Cheers,
    Yonatan

  • Display Image in Power View and Power BI

    Hi all,
    I need to create a report in power view where i need to display images in tile. I have found one solution to do so, to store the images as a binary data in data model table using the following link
    http://www.sharepointanalysthq.com/2014/09/adding-data-bound-images-to-power-view-with-power-query/comment-page-1/#comment-87049
    I tried this but still not able to show the images.
    Please anyone can help me with solution in detail.
    Thanks,
    Piyush Jain

    Hi Piyush,
    are you storing your Data in an Excel Power Pivot model?
    Make sure to follow step marking the column containing the Pictures as Data Type Binary.
    Are you using jpeg or another picture format?
    Best,
    Mark

  • Displaying image from Database with php

    Hello everybody,
    I'm working on a website that displays videos courses and tutorials as my final project
    and I'm working with "Flash builder 4" the database with mySQL and the application server with php
    Basically, the goal is to display a datagrid that shows the manager of the website in column all the information stored on the "Course" table
    the structure of the table is :
    Course (id,img,src,title,description)
    -id : primary key
    -img : path to a photo of course {for example picture of JAVA}
    -src : path to the playlist file {xml file}
    -title : String
    -description : String too
    I already succeeded to display all these contents on a DataGrid, but not with the image, I couldn't display an imageon its column using the path stored on the database, I used a DataRenderer to do that, and here is my code for Renderer and the DataGrid.mxml
    CourseGrid.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:courseservice="services.courseservice.*">
    <fx:Script>
    <![CDATA[
    import Renderers.CourseDeleteRenderer;
    import Renderers.CourseImageRenderer;
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
    getAllCourseResult.token = courseService.getAllCourse();
    ]]>
    </fx:Script>
    <fx:Declarations>
    <s:CallResponder id="getAllCourseResult"/>
    <courseservice:CourseService id="courseService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <mx:DataGrid x="10" y="10" id="dataGrid"
    creationComplete="dataGrid_creationCompleteHandler(event)"
    dataProvider="{getAllCourseResult.lastResult}"
    width="100%">
    <mx:columns>
    <mx:DataGridColumn headerText="" dataField="img" sortable="false" itemRenderer="Renderers.CourseImageRenderer"/>
    <mx:DataGridColumn headerText="id" dataField="id"/>
    <mx:DataGridColumn headerText="src" dataField="src"/>
    <mx:DataGridColumn headerText="title" dataField="title"/>
    <mx:DataGridColumn headerText="description" dataField="description"/>
    <mx:DataGridColumn headerText="Delete" itemRenderer="Renderers.CourseDeleteRenderer"/>
    <mx:DataGridColumn headerText="Update" itemRenderer="Renderers.CourseUpdateRenderer"/>
    </mx:columns>
    </mx:DataGrid>
    </s:Application>
    CourseImageRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      focusEnabled="true">
    <mx:Image source="{data}" width="60" height="60"/>
    </s:MXDataGridItemRenderer>
    Result :
    Problem :
    How can I access to the path of the image, I tried to write "data.img" instead of "data" as img is the name of the column in the database that stores the path but it wasn't successful.
    I know that it not complete statement "data" because "data" is a reference to what the DataGrid provides of information that gets from the (CreationComplete) event.
    Question :
    - Can you please help me with this so I can complete displaying images by accessing to what is on the column in tha DB so I can manipulate my datas that is stored there ?
    ==> I still have some questions about the buttons to update and delete datas fomr the DataGrid, but, until now I need to access successfully to the photo and display it
    Thank you,

    Anyone that can help me with this ?
    Please, try this with me, I'm asking Flex developpers this might be easy for you !
    It's just question of how to access the string stored in the variable "data", when I used XML I just type the path to the repeated element like this :
    XML file :
    XML File
    <parent>
    <child>
    <repeated_child></repeated_child>
    <repeated_child></repeated_child>
    <repeated_child></repeated_child>
    </child>
    </parent>
    I used a Model as a reference to the xml file
    and an arrayList as a container of the repeated child
    I just write in the code "data.parent.repeated_child" to access the text in the "repeated_child"
    and here is the code, that I implemented to generate videos from xml file to display a video play list
    Video Playlist code(extract from XML file "data.xml")
    <fx:Declarations>
    <fx:Model id="model" source="assets/data.xml"/>
    <s:ArrayList id="products" source="{model.video}"/>
    </fx:Declarations>
    <mx:List  dataProvider="{products}" labelField="title"
      change="list1_changeHandler(event,List(event.currentTarget).selectedItem)" x="103" y="77" height="350" width="198"/>
    That was my goal to do that with the database.
    Please help me
    If you have other solution I still need it.
    Thank you,

Maybe you are looking for

  • Is there a way to keep Bookmark Order from changing as part of sync?

    Since I added Aurora on my tablet and my phone, and set up sync, apparently those bookmarks toolbar are in a different order than my ones on my desktop. Every time I start my desktop versions, the toolbars are in some random order (the most visited a

  • Recovery from a crashed OS

    I am using Oracle 10g 10.0.1 on windows advance server 2000. The situation is that OS has been crashed and we have all the oracle's data available in hard drives. Now we have installed fresh copy of windows server. Now please guide me how to start or

  • Problem with BIB examples

    Hello, I have some problems with BIFrame.java (bootstrap project) when i try to connect : oracle.dss.bicontext.BINamingException: BIB-14736 BIUser does not exist in the BI Beans Catalog. However, I used BIBCAT login. A solution ? Thanks, Yann

  • Message problem 8520

    When I get a text it doesn't make a noise or appear in my messages I have to go to the sms inbox to view it. Also when I reply to texts I can only see all the texts I have sent but not the reply. I have checked the settings and they seem ok. It start

  • Need to re-install my CS6 student edition, but I don't have the complete serial number?

    My hardrive failed recently and I was able to get the serial number from Photoshop (under system info in help) before the whole thing went caput. However, it seems I am four numbers short of the whole serial number, and for some reason my registratio