Questions tagged [htmleditorkit]

htmleditorkit is an editor for document models which allows to convert these document models from and to HTML. Use this tag for questions related to this type of editor.

htmleditorkit is an editor for document models which allows to convert these document models from and to HTML. Use this tag for questions related to this type of editor.

90 questions
11
votes
6 answers

Convert HTML to plain text in Java

I need to convert HTML to plain text. My only requirement of formatting is to retain new lines in the plain text. New lines should be displayed not only in the case of
but other tags, e.g. ,

leads to a new line too. Sample HTML pages…
brayne
  • 1,355
  • 2
  • 16
  • 27
7
votes
1 answer

Insert HTML into the Body of an HTMLDocument

This seems like such a simple question, but I'm having such difficulty with it. Problem: I have some text to insert into an HTMLDocument. This text sometimes specifies some html as well. E.G.: Some
Random HTML I'm using…
Robbie
  • 892
  • 2
  • 7
  • 19
6
votes
3 answers

Disabling scrolling to end of text in JEditorPane

Hi I used a JEditorPane with HTMLEditorKit to showing HTML text with ability to wrap text. The problem is when I set it's content using .setText method it automatically scrolls to the end of that text. How can I disable this? Thanks.
Ariyan
  • 14,760
  • 31
  • 112
  • 175
6
votes
2 answers

Unordered List Bullets Look Pixelated in JEditorPane

I'm using an HTML unordered list to display some text within a JEditorPane. A sample of the HTML looks like this:
  • Cautious
  • Curious
This works all well and good, but strangely the bullets generated by
  • don't look to…
  • Thunderforge
    • 19,637
    • 18
    • 83
    • 130
    5
    votes
    3 answers

    How to make Swing use my own HTMLEditorKit for JLabel/JButton/etc

    Lets say I've made a sublcass of HTMLEditorKit (and other relevant classes) in order to display some custom HTML tags. I want to be able to to use these custom tags in JLabel, JButton, and so on. Is there any way to do this beside creating my own…
    Matthew Cline
    • 2,312
    • 1
    • 19
    • 36
    5
    votes
    1 answer

    How does one properly initialize a JTextPane StyleSheet, so no other HTML enabled component is affected by the style?

    I'm trying to use a JTextPane to render some HTML and apply a CSS stylesheet to it. This means I'm using HTMLEditorKit and StyleSheet classes. I know that all HTMLEditorKits share the same default StyleSheet instance, so if you change this default…
    predi
    • 5,528
    • 32
    • 60
    5
    votes
    3 answers

    Where can I find a good HTMLEditorKit tutorial/reference, which actually explains how to edit HTML documents?

    My intention is to edit HTML documents, including modifying existing elements, deleting elements and inserting new ones. I've read HTMLEditorKit's and related classes' documentation, as well as the relevant topic in Sun's Java Trail, yet there is…
    Oren Shalev
    • 952
    • 2
    • 9
    • 19
    4
    votes
    1 answer

    Java Swing: GlyphView : StateInvariantError after deletion of ordered/unordered list (HTMLDocument)

    I don't think this is a new issue. But it seems that there is an error that comes up whenever an ordered/unordered list in JTextPane (EditorKit -> HTMLEditorKit, Document -> HTMLDocument) is deleted from all the way down to the top using the…
    user396089
    • 1,115
    • 1
    • 12
    • 26
    4
    votes
    2 answers

    JEditorPane, HTMLEditorKit - custom action inserting custom tag

    I'm faithing with JEditorPane. I need simple editor. I've solved the problem with loading and modified HTML containing custom (two) tags (see my older post). It displays the document properly and I can even edit it now. I can write text, delete…
    Theodor Keinstein
    • 1,653
    • 2
    • 26
    • 47
    4
    votes
    1 answer

    Access/Change JEditorPane's html loaded elements + HTMLEditorKit problem with Unicode (Java)

    that's going to be a long question so bear with me :) My Application I'm developing a Java (with JFrame GUI) desktop application that does the following: Scan (.txt) files. Parses some numbers from these files, performs some calculations on them…
    RyanSF
    • 73
    • 1
    • 6
    4
    votes
    1 answer

    How to provide Functionalty for Changing the Background Color of Text Parts in HTML Editor built with HTMLEditorKit

    My problem is as follows: I want to enable the user of my little HTML editor to switch between different background colors for the text being entered. I first tried to use CSS styles for that purpose. The different styles define different background…
    apatwork
    • 71
    • 1
    • 8
    4
    votes
    4 answers

    how to load html to styledocument

    I'm using a StyleDocument to display my content in a JTextPane. I searched for a while and saw that I can write with the HTMLEditorKit the document I get from the textpane to a file. But when I want to read this file with the HTMLEditorKit it…
    Christian 'fuzi' Orgler
    • 1,682
    • 8
    • 27
    • 51
    3
    votes
    1 answer

    how to retrieve TITLE of a HTML with the help of HTMLEditorKit

    I want to retrieve TITLE attribute with the help of java's HTMLEditorKit ? this what I've written but it will return "null" all the time and inspector in eclipse doesn't help that much ! import java.io.FileReader; import java.io.InputStream; import…
    Vahid Hashemi
    • 5,182
    • 10
    • 58
    • 88
    3
    votes
    0 answers

    Creating hybrid EditorKit which can alternate between for example markdown and source-code

    Say I have an EditorKit for CSS styled Html (SwingBox), and I have an EditorKit for source code (SyntaxKit). Can I create a synthetic editor kit for a JEditorPane that combines these two, so that I can have interleaved HTML (which would come from a…
    0__
    • 66,707
    • 21
    • 171
    • 266
    3
    votes
    1 answer

    Set HTMLEditorExtender to open links in a new window

    I am trying to use the Ajax Toolkit HTMLEditor (June 2012 release) to improve a strictly internal application used to post news items and links (mostly to internal resources). Everything works very well except that I have been unable to get the link…
    stinkyP
    • 555
    • 6
    • 14
    1
    2 3 4 5 6