#11 Problems showing images



This is probably not a bug report, but I'm posting it here as instructed in:

Please have a look at it, I'm attaching a jar file that needs to be in the same dir as cobra.jar and js.jar, which you should have. This jar file contains both source code (RSVP.java) and binary to run it.

Also, if you're already looking into it, any ideas as to why when links are clicked, the target websites don't open?

Quick users manual for this buggy piece of browser:
type in an adress, wait for it to load, and then press the start button in the bottom right of the screen.
Note that the displaying of content stops whenever and image is to be shown, which will show a blank space on the screen.

If you're able to help, I'd be very appreciative!

Sergej Kotliar


  • Lobo Project Lead

    Logged In: YES
    Originator: NO

    Sorry for the late response. When I try to open the JAR file I get an error message that says "Invalid or corrupt JAR file". Is the JAR file 62Kb in size?

  • Sergej Kotliar

    Sergej Kotliar - 2007-08-13

    Logged In: YES
    Originator: YES

    No, it's supposed to be 104,5 KB.

    Tried downloading it here, worked fine. Will upload again, just in case. It's supposed to be placed in the lib folder that has cobra.jar and js.jar.

    File Added: RSVP.jar

  • Sergej Kotliar

    Sergej Kotliar - 2007-08-13

    Second try

  • Lobo Project Lead

    Logged In: YES
    Originator: NO

    Sorry, there must be a problem with SF's upload functionality. The second file is corrupted as well.

  • Lobo Project Lead

    • status: open --> closed-works-for-me
  • Lobo Project Lead

    Logged In: YES
    Originator: NO

    I tried downloading the attachment now and it worked, but I couldn't run the program. The version of Cobra the program was built for seems to be old. Now, what I did is try to reproduce the bug based on the original forum discussion. I came up with the following code:

    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.Reader;
    import java.net.URL;
    import java.net.URLConnection;

    import org.lobobrowser.html.*;
    import org.lobobrowser.html.gui.*;
    import org.lobobrowser.html.parser.*;
    import org.lobobrowser.html.test.*;
    import org.lobobrowser.html.domimpl.*;
    import org.w3c.dom.Document;
    import org.xml.sax.InputSource;

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;

    * Minimal rendering example: google.com.
    public class CobraImageTest {
    public static void main(String[] args) throws Exception {
    String uri = "http://lobobrowser.org";
    URL url = new URL(uri);
    URLConnection connection = url.openConnection();
    InputStream in = connection.getInputStream();

    Reader reader = new InputStreamReader(in);

    InputSource is = new InputSourceImpl(reader, uri);
    HtmlPanel htmlPanel = new HtmlPanel();
    HtmlRendererContext rendererContext = new LocalHtmlRendererContext(htmlPanel);


    DocumentBuilderImpl builder = new DocumentBuilderImpl(rendererContext.getUserAgentContext(), rendererContext);
    Document document = builder.parse(is);

    htmlPanel.setDocument(document, rendererContext);

    final JFrame frame = new JFrame();

    EventQueue.invokeLater(new Runnable() {
    public void run() {

    // Test follows: Programmatically add image
    // to document.

    final HTMLElementImpl element = (HTMLElementImpl) document.getElementById("thediv");
    ActionListener action = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    element.setInnerHTML("<img style=\"border: 1px solid black;\" src=\"http://www.google.se/images/hp0.gif\" width=\"100\" height=\"30\" alt=\"Google\"/>");
    javax.swing.Timer timer = new javax.swing.Timer(3000, action);

    private static class LocalHtmlRendererContext extends SimpleHtmlRendererContext {
    public LocalHtmlRendererContext(HtmlPanel contextComponent) {

    This code worked. Images can be set dynamically and programmatically in Java. Therefore, I'm closing the bug as unreproducible.


Log in to post a comment.