dasatti 0 Junior Poster in Training

I started developing an HTML editor using Java. After spending a lot of time I am now stuck in between. Most of the things are done but now I don't find any way to implement some of very important features. I think java is too weak too support these features. I am using JTextPane as a editor for html editing and javax.swing.text.html package. Here are the problems I face.

1) I insert images into the editor through code :

MutableAttributeSet attr = new SimpleAttributeSet();
//url is the image path
attr.addAttribute(HTML.Attribute.SRC, url);
//tpDesignDocument is the JTextPane
tpDesignDocument.getDocument().insertString(carretPosition, " ", attr);

Here you can see that images are inserted as a html string and I don't have any way the reference image objects on the pane to implement mouse listener to re-size these images. Even no way to detect any mouse clicks on the images. Can any body provide the solution.

2) same goes for the tables. I dont have any way to use mouse to re-size tables.

3) In the JTextPane the images do not appear if the file path of the images do not start with "file:" for examples image for code <img src="file:G:\image.jpg"> will appear in the pane but if I use <img src="C:\image.jpg"> it will not appear.

There are countless other problems that I am facing and java's jext.html package seems too weak for development of a full fledged html editor. Any suggestion on that? I tried to search for some professional html editor based on pure java but couldn't find any. There are many on source forge which do only basic html editing tasks much less than what mine's do.

You can download my html editor from SNIP .

Need your suggestions and help to carry this project further.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.