Image as well as Text in a Component

i need a TextArea Like component in JAVA,

which can RECEIVE text as well as image.

The user can enter text and copy image into it.

this swing component's content i have to save in a database,

and retrieve it.

plz help me to solve the issue.

1)TextPane ,JEditorPane can be used?.this trial failed.

2) is there any other method to solve it?

-bejoy

[401 byte] By [BEJOYa] at [2007-11-26 22:54:31]
# 1
> 2) is there any other method to solve it?create your own Component?
suparenoa at 2007-7-10 12:18:26 > top of Java-index,Desktop,Core GUI APIs...
# 2
My requirement is like this.the user may enter some text then he may copy an image to theTextArea , then he may again continue.. just like creating a documentat last i want content in a servlet then save it to database.how it can be achieved?
BEJOYa at 2007-7-10 12:18:26 > top of Java-index,Desktop,Core GUI APIs...
# 3
My requirement is like this.the user may enter some text then he may copy an image to theTextArea , then he may again continue.. just like creating a documentat last i want content in a servlet then save it to database.how it can be achieved?
BEJOYa at 2007-7-10 12:18:26 > top of Java-index,Desktop,Core GUI APIs...
# 4
you can read this, it may help you http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.htmlthere is images in panes but i don't know if you can cut n paste in the pane...
suparenoa at 2007-7-10 12:18:26 > top of Java-index,Desktop,Core GUI APIs...
# 5

This is one way to support pasting of images and text into a JTextPane:

JTextPane pane = new JTextPane();

pane.getActionMap().put("paste-from-clipboard", new AbstractAction() {

public void actionPerformed(ActionEvent e) {

JTextPane pane = (JTextPane) e.getSource();

Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);

if (t.isDataFlavorSupported(DataFlavor.imageFlavor)) {

BufferedImage image;

try {

image = (BufferedImage) t.getTransferData(DataFlavor.imageFlavor);

pane.insertIcon(new ImageIcon(image));

} catch (Exception e1) { e1.printStackTrace(); }

}

else

pane.paste();

}

});

Saving the content and loading it back is a completely different story...

Rodney_McKaya at 2007-7-10 12:18:26 > top of Java-index,Desktop,Core GUI APIs...
# 6

i have tried the above code .

i tries as follows

1) I TRIED TO USE JTextPane, JEditorPane .

but when these applets come to the webpage it gives security exception comes.

i have to use these component in an Intranet site.

2) how to get the data as a stream without missing the sequence of data from the JTextPane or JEDitorPane?.

3)is it possible to store data as a stream(i know possible but..) while showing in JSP is it possible

to render the text part of the stream as text and image part of the stream as image?

4)Plz is there any other method? to achieve this?

-bejoy

josephnellisserya at 2007-7-10 12:18:26 > top of Java-index,Desktop,Core GUI APIs...