htmleditorkit « Text Input « Java Swing Q&A





1. Why is Swing Parser's handleText not handling nested tags?    stackoverflow.com

I need to transform some HTML text that has nested tags to decorate 'matches' with a css attribute to highlight it (like firefox search). I can't just do a simple replace (think ...

2. How do I retrieve the attribute of an element using Swing's HTMLEditorKit.ParserCallback?    stackoverflow.com

I am extending HTMLEditorKit.ParserCallback to parse HTML. I am matching on a certain element type in an overridden method like this:

@Override
public void handleStartTag(Tag t, MutableAttributeSet a, int pos) {
   ...

3. Strange HTMLEditorKit problem    stackoverflow.com

The code snippet below has the problem, that it will not work, if the reload button is pressed in the browser containing the applet window. It works on the first start ...

4. How to make Swing use my own HTMLEditorKit for JLabel/JButton/etc    stackoverflow.com

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 ...

6. Custom Visual Markup using the HtmlEditorKit    coderanch.com

Hi friends, I'm trying to create a 'simple' html/xml editor, where I can highlight a word/s then click a button which applies a markup tag to the selection. Also depending on the markup tag the editor pane would show a visual change (but not the makup tag) i.e. sky shows only the word sky in blue. I've tryed using a JTextPane() ...

7. HTMLEditorKit    coderanch.com

I hav a JEditorPane and I am using HTMLEditorKit to display text in it in 2 contenttypes 1]HTML (text/html) 2]TEXT i.e the source view of the same HTML (text/plain) The content-type view, i.e. the WYSIWYG view for the HTML and the source view for the HTML is switched using a group of 2 radio button selection. My problem is that, I ...

9. Subclassing HTMLEditorKit    coderanch.com

I've never done this for replacing the handling of a standard type, but for a non-standard type, you do this: myJEditorPaneInstance.setEditorKitForContentType("text/foo", myCustomEditorKitInstance); before setting the content type or loading in a file. I'd try this first and see if it works -- I'd expect it to, but you never know, I guess.





10. HTMLEditorKit & Performance    coderanch.com

i gave this a quick try and ... it wasn't so quick. however, performance was not horrible - especially for smaller or less complex documents. just some ideas from a 10k ft view: possible places to look(?) - (1) Format of the HTML report(s) you're reading JEditorpane - from what i can see - has about 15 html handling bugs being ...

11. custom tags using an HTMLEditorKit subclass    coderanch.com

I've created a subclass of HTMLEditorKit called CustomEditorKit(see code below) At the point in the code marked with the 'UGH' comment, I want to check to see if the unknown element is of type x+4 and create return a Custom View object containing the 'x+4' inside the tags... I figured out how to check to see that the element is indeed ...

12. using HTMLEditorKit and trying to INDENT, what is the HTML tag for INDENTATION ?    coderanch.com

Hi guys, I'm using an HTMLEditorKit with HTML tags. since i am newbie to html I wonder if anyone knows how to indent in a text??? My end result suppose to be like this: Date: Nov 27, 2004 File: dans.txt The indentation suppose to take place between the date ("Nov 27, 2004") and the word "File" my code looks like this: ...

13. Applying CSS in HTMLEditorKit    coderanch.com

14. Maintaining paragraph in HTMLEditorKit    coderanch.com

15. StyleSheet in HTMLEditorKit    coderanch.com

Hi! I try to change a style by using the following code SimpleAttributeSet cls = new SimpleAttributeSet(); cls.addAttribute(HTML.Attribute.STYLE, "text-decoration: underline;" ); SimpleAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(HTML.Tag.SPAN, cls); setAttributeSet(attr , false ); private void setAttributeSet( AttributeSet attr, boolean setParagraphAttributes ) { int xStart = editor.getSelectionStart(); int xFinish = editor.getSelectionEnd(); if( ( xStart != xFinish ) || setParagraphAttributes ){ SimpleAttributeSet s = ...

16. HTMLEditorKIT    coderanch.com

Originally posted by vidya sagar: In my application there is textarea in which users are allowed to paste their html content(possibly mail contents from outlook they have paste it). For that i used below code JTextpane subjectPanel = new JTextPane(); subjectPanel.setContentType("text/html"); subjectPanel.setEditorKit(new javax.swing.text.html.HTMLEditorKit()); While running,when i copied contents from outlook and pasting into application, extra brackets along with text wording 'fragments' ...





18. parsing HTML with Swing's HTMLEditorKit.Parser problem    forums.oracle.com

I've been using the HTMLEditorKit.Parser to do parsing on a html page just fine until I wanted to get an element inside of an . The parser has no problem finding the tag but then it doesn't seem to find the tag inside it. Does anyone know how to resolve this? Any help would be greatly appreciated. Thank ...