Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Image not displayed in JEditorPane

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I simply try to load a HTML page into a JEditorPage. The page is ok but no image are there... here is a part of my code:
The buff variable contains the HTML. Here is a part of that String... the image tag:

<img src="file:\\c:\standardlogo.jpg" width=768 height=92></img> ...it cannot be more static...

public XmlValidationResultViewer(String buff){
setTitle( "XML Validator Viewer" );
setSize( 830, 600 );
getContentPane().setLayout( new BorderLayout() );

JPanel topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel, BorderLayout.CENTER );
try{
html = new JEditorPane("text/html", buff );
html.setEditable( false );

JScrollPane scrollPane = new JScrollPane();
scrollPane.getViewport().add( html, BorderLayout.CENTER );

topPanel.add( scrollPane, BorderLayout.CENTER );

this.setVisible(true);

}catch (Exception e){
System.out.println("ERROR: " +e.getMessage());
}
}

}

Please tell me why the image are not showed... If I save the content of buff in a file and I load it with Explorer, the images are there...

Thanks

Alain
 
Bartender
Posts: 9582
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a wild guess, but URL's are supposed to have forward slashes.
 
Die Fledermaus does not fear such a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!