Displaying HTML page with images from ZIP?

Discussion in 'Java' started by Cruithne3753, Feb 6, 2008.

  1. Cruithne3753

    Cruithne3753 Guest

    I'm doing something where I've got optional resource modules packaged in
    ZIP files, this includes an information page in HTML. I can use
    JTextPane to display the text, but cannot see how to get it to display
    its images.

    Any ideas?

    Cheers,

    Matt
     
    Cruithne3753, Feb 6, 2008
    #1
    1. Advertising

  2. On Feb 7, 9:46 am, Cruithne3753
    <> wrote:
    > I'm doing something where I've got optional resource modules packaged in
    > ZIP files,  this includes an information page in HTML.  I can use
    > JTextPane to display the text, but cannot see how to get it to display
    > its images.


    It is relatively easy to do. Simply ensure that
    all resource in the HTML are referenced with
    relative paths, then include the resources in the
    same ZIP file. If JEditorPane can find the HTML,
    it should be able to find stylesheets and images
    etc.

    > Any ideas?


    Post an (short) example HTML that is failing,
    a description or listing of the ZIP content
    that shows the HTML and the resource, and an
    SSCCE* (should take no more than 20 lines of
    code).

    Actually, I doubt the problem here is code,
    so the last might not be needed.

    * <http://www.physci.org/codes/sscce.html>

    --
    Andrew T.
    PhySci.org
     
    Andrew Thompson, Feb 7, 2008
    #2
    1. Advertising

  3. On Feb 7, 9:46 am, Cruithne3753
    <> wrote:
    > I'm doing something where I've got optional resource modules packaged in
    > ZIP files,  this includes an information page in HTML.  I can use
    > JTextPane ...


    I was skimming and thought you wrote
    JEditorPane there - it is far better
    for HTML.

    --
    Andrew T.
    PhySci.org
     
    Andrew Thompson, Feb 7, 2008
    #3
  4. Cruithne3753

    Roedy Green Guest

    On Wed, 06 Feb 2008 23:46:01 GMT, Cruithne3753
    <> wrote, quoted or
    indirectly quoted someone who said :

    >I'm doing something where I've got optional resource modules packaged in
    >ZIP files, this includes an information page in HTML. I can use
    >JTextPane to display the text, but cannot see how to get it to display
    >its images.


    The images inside jars are called "resources". You find the
    corresponding URL with getResource. From there you can load the
    images in the usual way.

    For details see http://mindprod.com/jgloss/image.html
    http://mindprod.com/jgloss/resource.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Feb 11, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    1
    Views:
    605
    Andrew Thompson
    Sep 16, 2004
  2. Replies:
    0
    Views:
    1,739
  3. HARI OM
    Replies:
    0
    Views:
    17,432
    HARI OM
    May 3, 2005
  4. sunil_varma
    Replies:
    1
    Views:
    1,192
  5. Cruithne3753
    Replies:
    3
    Views:
    1,643
    Cruithne3753
    Feb 12, 2008
Loading...

Share This Page