问题
I'm making a Unicode translator in Java. I did all hard parts, but now I want to add a resizable, relocatable image to the textpane. The user must be able to resize image with its corners and drag & drop the image within the textpane where he likes. (like Microsoft Word or Photoshop)
Something like this:
I tried the Styled Document properties. But I couldn't find way except inserting only an ImageIcon
.
回答1:
May be a better choice would be not to use textPane.
If you have an custom editable label, that can be edited by double clicking on it to show a text box to edit the contents, and change the text of the label when enter key is pressed.
Also give a shot of JDesktoppane, JLayeredPane, and check what components can be added to it.
回答2:
try this http://mgeisler.net/downloads/browser/src/ImageBox.java.html
回答3:
try loading the image inside a JLabel component in JFC Swing. Otherwise try some other non editable components in the same technology with resizable property.
回答4:
try this http://sourceforge.net/projects/ird/
the iRD is a component for Resize and move(drag&drop) compoennts on runtime in java.
来源:https://stackoverflow.com/questions/6288064/how-to-make-java-run-time-sizable-image-box