aspose file tools*
The moose likes Applets and the fly likes selectable text -> copy to clpboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "selectable text -> copy to clpboard" Watch "selectable text -> copy to clpboard" New topic
Author

selectable text -> copy to clpboard

glen croteau
Greenhorn

Joined: Apr 10, 2008
Posts: 15
I am using graphics.drawChars to write static text to a signed applet. I would like to be able to select this text and copy it to the system clipboard. I have the copy to clipboard part working. However I need to find a way to allow the user to select the text which I will add to the StringBuffer and then transfer to the clipboard.

Advice please.
Thanks!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42932
    
  68
Once it's drawn, the JRE has no idea that it was text to begin with, so unless you keep track of all text that is drawn and can retrieve it later during the "select" operation, this would be difficult to achieve (barring the use of OCR).

You'd also need to keep track of where on the Graphics which text is drawn (x/y coordinates), so that you can associate the user's selection with the text.
glen croteau
Greenhorn

Joined: Apr 10, 2008
Posts: 15
Ulf, thank you for your response. Obvious now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: selectable text -> copy to clpboard