samedi 28 février 2015

Resizable image in JTextPane

I want to my JTextPane be able to resize pictures by drag and drop. Like in this article: http://ift.tt/1EzIffT


I’m able to implement it exactly like in this article with simply inserting panel into the JTextPane and insert image into this panel. It works, but it is useless for me, because I'm using AdvancedRTFEditorKit for writing document into the file. This approach disrupt Document and therefor EditorKit is not able to save images into the file.


Is there some way to implement this function without disrupted Document? Just somehow change the IconView of EditorKit?


I’m so far that my editor is able to showing hand cursor, if cursor is above the image. (Exactly like in this article: Detecting image on current mouse position only works on part of image)


I’m able to catch mouseClicked event on image by using same approach, but I really don’t know, how can I get instant of IconView to paint borders on image.


Like this:


enter image description here


Or is there another way, how to do that? I will really appreciate any idea.


Aucun commentaire:

Enregistrer un commentaire