Need help.. displaying images with setText on a JEditorPane

Does anybody know how to embed an image into html text when using the JEditorPane.setText?
The images are stored in a jar file, and we know how to retrieve them and store them in an Image object from getDefaultToolkit().getImage()
Sample codes would be really nice, but any answers will be greatly appreciated. Thanks!

The following is from some code I worked on a while ago, seemed to work fine however this was only a test tool so I didnt test it fully!
public static final java.net.URL ERROR_ICON = ClassLoader.getSystemResource ("xmlviewer/res/error.gif");
// some code....
public void reportError (String msg) {
        String err = "<img src=" + ERROR_ICON.toString() + "> " +
                     makeHTMLFriendlyString(msg) + "<br>";
        reportList.append (err);
        jTextAreaParseErrors.setText (  reportList.toString() );
}Obviously you will have to put your own image path into the .getSystemResource call. Hope this helps!
Jon

Similar Messages

  • 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

  • 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

  • Need help Loading images with selection on a form field?

    So I'm kind of a newb.. I can do basic forms but I need to set up a form field drop down box that will give me the ability to load images correlating to the users choice. I'm at a total loss for where to start, so ANY help would be appreciated. If you know of any good books or tutorials on the subject please share.
    Thanks in advance
    Sincerely,
    Stumped4now 

    P.S. I think I'm getting a better understanding of OCGs after lots of research today. However I still seem to be missing something
    var docOCGs = this.getOCGs();
    for (var x=0; x < docOCGs.length; x++)
      if(docOCGs[x].name == "Layer1")
      docOCGs[x].state = !docOCGs[x].state;

  • How can i Display images with may own table

    Hi
    I want display images with my own table. How can I use in this query.
    SELECT    '<a href="#" onclick="javascript:'
           || 'getImageHeight(''my_img'
           || '#ROWNUM#'');javascript:redirect'
           || '(''f?p=&APP_ID.:212'
           || ':&SESSION.:DISPLAY:NO::P212_IMAGE_ID:'
           || ID
           || ''');">'
           || '<img src="#IMAGE_PREFIX#edit.gif" '
           || 'alt="Edit"></a>' ID,
              '<img id="my_img'
           || '#ROWNUM#" src="#WORKSPACE_IMAGES#'
           || filename
           || '"/>' image
      FROM wwv_flow_filesThanks
    Nr
    Edited by: user10966033 on Sep 28, 2009 1:41 PM

    You don't use #workspace_images# since that is for STATIC files, not images in a table..
    see this thread for help: Re: Display image from blob
    Thank you,
    Tony Miller
    Webster, TX

  • Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    If you think you're insane now, try maintaining those pop up menus.
    As far as I know, these menus have not been updated since FW 8, so 
    they are at least two versions old.
    Save yourself a lot of grief by avoiding those menus. There are many 
    other products on the market which do a much better job of creating 
    and maintaining this type of navigation structure.
    Read this link before you climb any higher on this slippery slope:
    http://apptools.com/rants/jsmenu.php
    There was another blog post by the fellow who originally wrote the pop 
    up menu feature, but I can't seem to locate it. Even he says stay away 
    from them.
    Not the answer you probably want, but I hope it helps, nonetheless.
    Jim Babbage

  • TS1314 Need help tranfering images to iphone...

    I need help tranfering images from my computer to my iphone. I've synced the images but they don't appear on my iphone, also on the file that contains the images, there's a file that says IPOD PHOTO CACHE. I don't know what to do. Please Help...

    Hope these help, do you not find them at all in the photos app?:
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPhoto '11: View photos or slideshows on iPod, iPhone, iPad, or Apple TV
    http://support.apple.com/kb/PH2437
    iTunes: Understanding the iPod Photo Cache folder
    http://support.apple.com/kb/TS1314
    ============================
    - Oz

  • I needs to Display Tree With in the table, Please Help me

    I needs to display
    First Table, then inside the table tree, whenever I expand the tree then all the specified Childeren should display in another table.
    Please give me solution with example(code)
    this is simple Example
    A
    a1
    a11
    a12
    a13
    a2
    a3
    B1
    C1
    But I needs to display following format(that means with in the table)
    first step(Normal mode)
    A
    B
    C
    whenever I expand A(expand mode)
    A
    a1
    a2
    a3
    Whenever I expand a1 then(I needs to display this format) This is final Expand
    A
    a1
    a11
    a12
    a13
    a2
    a3
    B1
    C1
    Please Help me. This is very important for me. Because I am doing project. Please help me..with example

    maybe this,
    http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html

  • Need help on image for my business.

    hi. I'm Mike Gambino, admin/founder of my own website called http://gambinoarmy.co.cc/. I've been using macromedia for this stuff but apparently, y'all have better stuff than macromedia and I started using the schools. I have a trial on my computer for 30 days and I have been using it and I need to know how to do something. I see that lots of business owners have images that are linked on their site and it is making me mad that everytime I want to make an image, fireworks will not let me do anything on it.
    there is something I want to do and it is to make an image that shows their signature, if they are online or not, when level their at, how long they have been playing, and so forth. I want to know if someone can help me give me a tutorial on how to make an image with HTML embeded into the image source so I can make it so that it is live and will work like most businesses do.
    since I hardly go on since I'm trying to edit my site still, I would like someone to email me at [email protected] so I can get it right on my computer and I will not have to hunt down this forum post. I'm mostly busy and I'm trying to keep my site running and up to date and it is a busy week for me since I'm trying to do a grand opening of my site since someone hacked my site and edited a lot of things and now I secured it and everything and recovered my lost data.
    please help me.

    gambino90 wrote:
    I wish I had the money too. I can't invest anymore on my site till lots of people come on my site and donate.
    I can't speak to your business model.
    is there even a way to take HTML scripts of PHP scripts, put it in a document and try using a <img src=" " /> code to try making it into an image?
    The wording of that question doesn't even make sense. HTML is not scripting, it isn't programming. It is markup for text display. The image tag is also not programming; it is the markup for HTML that displays an image that has been created and stored.
    For your desired functionality, something could probably be done with PHP and a database, if the person doing the work knew what he or she was doing. In any case, it isn't a Fireworks question. Fireworks creates graphics and it can output some HTML. It is not a programming environment.
    If you want to put the your desired functionality into your site yourself, you first need to learn what HTML is and is not, what it can and can't do. Then, you need to move on to learning a programming language (for example PHP, ColdFusion, Perl, C#/.NET), as well as SQL (the language) and some database expertise. You also will need to learn about securing your database-driven site.
    Good luck!

  • Need help to start with some file and text manipulation

    Hello script mavens,
    I need help with starting a script that does the following:
    -within a base folder it takes an inventory (list?) of all the files (which happen to be image files).
    -creates a new folder inside the base folder and calls it imagesX where X increases by one every time the script is run
    -moves all the files into the images folder
    -within the base folder it creates a new text file and calls it imagesX.js
    -writes a "//-" into imagesX.js
    -then writes the list of filenames into the imagesX.js twice, separated by an empty line, and adds a semicolon to the end of each filename and saves imagesX.js
    -from a folder a level above the base folder it copies a file called index.html into the base folder and renames in indexX.html
    -in indexX.html it replaces a string "replaceThis" with "imagesX.js"
    The task is more complex but this would help me tremendously do the rest.
    If I am asking for too much on this forum please let me know

    This should get you started.
    The description of how you want to write the data isn't clear, but the rest should work (untested):
    property imageNum : 0 -- last used ImageNumber
    -- within a base folder it takes an inventory (list?) of all the files (which happen to be image files).
    -- get the folder:
    set baseFolder to (choose folder)
    -- now get the files within it:
    tell application "Finder"
    set fileList to every file of folder baseFolder as alias list
    end tell
    --creates a new folder inside the base folder and calls it imagesX where X increases by one every time the script is run
    tell application "Finder"
    set imageNum to imageNum + 1
    set newImageFolder to make new folder at baseFolder with properties {name:"images" & imageNum}
    -- moves all the files into the images folder
    move every file of folder baseFolder to newImageFolder
    --within the base folder it creates a new text file and calls it imagesX.js
    set textFile to (open for access file (baseFolder as text) & "images" & imageNum & ".js" with write permission)
    --writes a "//-" into imagesX.js
    write "//-" to textFile
    -- then writes the list of filenames into the imagesX.js twice, separated by an empty line, and adds a semicolon to the end of each filename and saves imagesX.js
    -- need more info here
    -- a blank line between each instance of the file name? or all file names, blank line, all file names again?
    -- an example, please
    close access textFile
    --from a folder a level above the base folder it copies a file called index.html into the base folder
    --and renames in indexX.html
    --in indexX.html it replaces a string "replaceThis" with "imagesX.js"
    -- the easiest way of doing this is to read the file and write a new copy with the changes - that's easier than changing it in situ:
    set indexHTML to (read file "index.html" of folder (container of baseFolder))
    set {oldTIDs, my text item delimiters} to {my text item delimiters, "replaceThis"}
    set indexHTML to text items of indexHTML
    set my text item delimiters to "imagesX.js"
    set indexHTML to indexHTML as text
    set my text item delimiters to oldTIDs
    set indexFile to (open for access file ("index" & imageNum & ".html") with write permission)
    write indexHTML to indexFile
    close access indexFile
    end tell

  • Displaying images with a menu ring

    Hi,
    What i want is  a menu ring ring that can give a choice to run indivdual tests . Test A, test b , test c test d . The results of each test to be displayed seperately with text on each image showing from which test the image came from,
    Iam attaching an file that iam trying to implement this on.
    Thanks for your help.
    (requirements labview 7.1 and vision assistant)
    Attachments:
    help.vi ‏128 KB

    I think you can use the Picture Ring for your appliction.
    - Partha
    LabVIEW - Wires that catch bugs!

  • Need help  Pagination Suppourt with DataGrid

    Hi ,
    When i do a search Operation , the data from Database is huge and i think if i display all of them at a Time it will be a performance and response Time issue .
    So the question i am asking is that , can any body please give me a basic idea as how to implement Pagination with DataGrid Results ??
    Need help with Datgrid and Pagination suppourt .
    Thnaks in advnace .

    Hi Kiran,
    Try referring to the below link...
    http://www.flexicious.com/
    Thanks,
    Bhasker Chari.S

  • Need Help Displaying Code128 Bar Code

    I have an ASP classic page were I can render a 3of9 bar code using Javascript where the bar code is rendered as an image.  I need to do the same thing using code128 but can't find a suitable script.  Does anyone have one they are willing to share?  I have Googled this to death!  Thanks in advance for any help!

    From CPAN FAQs:
    Barcode::Code128 generates bar codes using the CODE 128 symbology. It can generate images in PNG or GIF format using the GD package, or it can generate a text string representing the barcode that you can render using some other technology if desired.
    The intended use of this module is to create a web page with a bar code on it, which can then be printed out and faxed or mailed to someone who will scan the bar code. The application which spurred its creation was an expense report tool, where the employee submitting the report would print out the web page and staple the receipts to it, and the Accounts Payable clerk would scan the bar code to indicate that the receipts were received.
    The default settings for this module produce a large image that can safely be FAXed several times and still scanned easily. If this requirement is not important you can generate smaller image using optional parameters, described below.
    If you wish to generate images with this module you must also have the GD module (written by Lincoln Stein, and available from CPAN) installed. Using the libgd library, GD can generate files in PNG (Portable Network Graphics) or GIF (Graphic Interchange Format) formats.
    Starting with version 1.20, and ending with 2.0.28 (released July 21st, 2004), GD and the underlying libgd library could not generate GIF files due to patent issues, but any modern version of libgd (since 2004) can do GIF as the patent has expired. Most browsers have no trouble with PNG files.
    In order to ensure you have a sufficiently modern installation of the GD module to do both GIF and PNG formats, we require version 2.18 of GD (which in turn requires libgd 2.0.28) or higher.
    If the GD module is not present, you can still use the module, but you will not be able to use its functions for generating images. You can use the barcode() method to get a string of "#" and " " (hash and space) characters, and use your own image-generating routine with that as input.
    To use the the GD module, you will need to install it along with this module. You can obtain it from the CPAN (Comprehensive Perl Archive Network) repository of your choice under the directory authors/id/LDS. Visit http://www.cpan.org/ for more information about CPAN. The GD home page is: http://stein.cshl.org/WWW/software/GD/GD.html
    I believe that is EXACTLY what you're looking for.

  • Need help getting images for blog aggregator

    I need help trying to grab images into a blog aggregator...
    Here is the code that gets the image.
    <!--- Get thumbnail, if exists --->
    <cfset content_to_parse = temp_description_full>
    <cfinclude template="module_get_images.cfm">
    <cfif IsArray(image_array) AND ArrayLen(image_array)>
    <cfloop from=1 to=#ArrayLen(image_array)# index="j">
    <cfhttp url="#trim(image_array[j].link_url)#"
    method="get" throwonerror="No" timeout="15" getasbinary="Auto"
    resolveurl="No" />
    <cfif IsBinary(cfhttp.filecontent)>
    <cfset tmp_filename = "thumbnail_entry_" & GetID.id
    & "." & image_array[j].file_type>
    <cffile action="WRITE"
    file="#ExpandPath(request.base_relative_url &
    '/blog_thumbnails/' & variables.tmp_filename)#"
    output="#cfhttp.filecontent#">
    <cfset thumb_image = request.img.process_image(image_path
    = ExpandPath(request.base_relative_url & '/blog_thumbnails/'
    & variables.tmp_filename), max_width = 120, max_height = 120,
    crop_area = "center")>
    <cfimage source="#thumb_image#" action="write"
    destination="#ExpandPath(request.base_relative_url &
    '/blog_thumbnails/' & variables.tmp_filename)#"
    overwrite="yes">
    <cfquery name="UpdateEntry"
    datasource="#request.data_source#" username="#request.db_un#"
    password="#request.db_pw#">
    UPDATE aggregated_blog_entry
    SET aggregated_blog_entry_thumbnail_image_tx =
    '#left(variables.tmp_filename,255)#'
    WHERE aggregated_blog_entry_id = #GetID.id#
    </cfquery>
    <cfbreak>
    </cfif>
    </cfloop>
    </cfif>
    ---------This is the module_get_images.cfm
    code----------------
    <cfset start_pos = 1>
    <cfset image_array = ArrayNew(1)>
    <cfset regex_image = "<img[^>]*>">
    <cfset regex_image_url =
    "(((https?:|ftp:|gopher:)\/\/)|(www\.|ftp\.))[-[:alnum:]\?%,\.\/&##!;@:=\+~_]+[\-A-Za-z0- 9\/]">
    <cfloop condition="1">
    <cfset temp_image_pos = REFindNoCase(regex_image,
    variables.content_to_parse, start_pos, true)>
    <cfif temp_image_pos.pos[1]>
    <cfset temp_link =
    mid(variables.content_to_parse,temp_image_pos.pos[1],temp_image_pos.len[1])>
    <cfset link =
    REFindNoCase(regex_image_url,temp_link,1,1)>
    <cfif NOT link.pos[1]>
    <cfset temp_link_url = "">
    <cfelse>
    <cfset temp_link_url =
    mid(temp_link,link.pos[1],link.len[1])>
    </cfif>
    <!--- Don't show links to images --->
    <cfif len(trim(temp_link_url)) AND
    ListFindNoCase("jpg,jpeg,gif,bmp,png",left(ListLast(temp_link_url,"."),3))>
    <cfset image_array[ArrayLen(image_array)+1] =
    StructNew()>
    <cfset image_array[ArrayLen(image_array)].link =
    temp_link>
    <cfset image_array[ArrayLen(image_array)].link_url =
    temp_link_url>
    <cfset image_array[ArrayLen(image_array)].file_type =
    left(ListLast(temp_link_url,"."),3)>
    </cfif>
    <cfset start_pos = temp_image_pos.pos[1] + 1>
    <cfelse>
    <cfbreak>
    </cfif>
    </cfloop>
    This is the type of code it has a hard time getting the image
    becuase it doesn't have a regular IMG tag.
    <div style="float: left; width: 82px; height: 59px;
    overflow: hidden; background: url(
    http://pix.crash.net/motorsport/80/388493.jpg);
    background-position: center center; background-repeat: no-repeat;
    margin: 1px;" onMouseOver="showTipGallery(Stoner, Australian MotoGP
    2007);" onMouseOut="clearTip();">
    Is there a way to modify this code to make it be able to look
    for the backround: url?? I am thinking that woul help it.. It knows
    that an image is there.. It just doesn't know what to do with
    it.

    How difficult is it for you to do a google image search for large images of this subject?
    While you appear to be doing this project for an educational endeavour and can get away with mild copyright abuse as "fair use", you probably should not expect the participants in this forum to 1) work for Disney either as a direct employee or as a contractor and 2) offer their copyrighted work for free.
    If you really want to impress a teacher and a future employer, you would use your own art. Why dont you create your own movie concept? Suppose you and your classmate are up for the same employment position. Who do you think will get hired if you show work that is not all your own, while your classmate has produced all of his/her own work?

  • Display image with display tag

    Hi,
    I am using display tag but I don't know how to display the image in the display tag....let me explain how I fetched data and what I want to display..
    1. I kept all the images in the folder "userfiles" on the server and saved the url in the table(database).
    2. I fetched all the rows from table using the select statement and saved it into bean class and then to the list as....
    while(rs.next()) {
    String a="../userfiles/"+rs.getString(4)+"";
    System.out.println(a);
    list.add(new newsFetchBean(rs.getInt(1),rs.getString(2),rs.getString(3),a));
    everything is working fine and I am able to show data in the display tag on my jsp page using ...
    <display-el:table id="table1" pagesize="20" cellpadding="0" cellspacing="1px" name="newsList" requestURI="" class="displayTag" sort="list" export="true">
    <display-el:caption style="font: bold 1em Arial, Sans-Serif;padding: 15px 0 0 0;color:#009933;">Inquiries Received From Latest To Old</display-el:caption>
    <display-el:column title="Heading" property="vnews_heading" sortable="true" headerClass="sortable"></display-el:column>
    <display-el:column title="News Content" property="vnews_content" sortable="true" style="width:200px;" headerClass="sortable"></display-el:column>
    Problem: I need to show images form "userfiles" folder for whom URL is being fetched from the database as...
    String a="../userfiles/"+rs.getString(4)+"";
    System.out.println(a);
    list.add(new newsFetchBean(rs.getInt(1),rs.getString(2),rs.getString(3),a));
    in the upper statements....
    Please tell me how to show images....
    I tried .....
    <display-el:column title="Image" sortable="true" style="width:250px;" headerClass="sortable" ><img src="<c:out value="#{table1.vnews_imageURL}"/>"></display-el:column>
    but no success and I searched a lot for it....may be I am wrong in my search but please help......

    Open the page in your browser.
    View the generated HTML source.
    Take a look at the <img> element.
    Does its 'src' attribute point to a valid URL? Can you request that URL independently?

Maybe you are looking for