Like many people asking questions, I am just starting to get acquainted with java, so I ask you to stick your nose at a specific example.

The task is as follows: this is a simple java application. There is a .htm document (with text, pictures, tables, and the like). It is necessary to display only those paragraphs of the .htm document that contain a previously known word on the JEditorPane.

The question of JEditorPane, because it easily and correctly turns out to display a motley document, but it turns out only entirely. If there is a simpler approach, I will be happy with the recommendations.

  • one
    If the part then add the <html> <body> - to the beginning and </ body> </ html> at the end to the end and the beginning of the text. Then JEditorPane will work with the text as with the html document. - Maxim Drobyshev
  • I suppose the paragraph - there is a tag <br> , right? I think it can be solved like this: load the doc into the object into a string, (String variable), (for experienced users: I don’t use StringBuilder and their ilk for reasons of ease of explanation) to split the array of paragraphs into paragraphs - split("<br>") , and sort the array in the foreach-cycle, analyzing each paragraph for the presence of the desired word through the contains("выражение") , and when getting a match, add to the final result variable. And for textEditor.(setText(rezult)); - textEditor.(setText(rezult)); ) - OldTeaOwl

0