# How do I draw some strings that can be copied?

**URL:** <https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472>\
**Category:** Ignition\
**Created:** [January 4, 2018, 7:59am UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472 "2018-01-04T07:59:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![guanghui](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@guanghui](https://forum.inductiveautomation.com/u/guanghui)\
**Post date:** [January 4, 2018, 7:59am UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472/1 "2018-01-04T07:59:22Z")

</div>

Hello,I have draw a flow chart in Paintable Cavans, and the string was drawed by java2d drawString(str,x,y) . but I would like to make the strings could be selected and copied,does anyone know how to do it?  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2a15a948abc29c371cba77321c8c1e0429d6d1e4.png)

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [January 4, 2018, 8:08am UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472/2 "2018-01-04T08:08:26Z")

</div>

This brings you into the pure Java environment. It’s technically possible, but not easy.

You should add your own mouse listener, and keep track of the strings somewhere to bind them to screen coordinates.

See [https://stackoverflow.com/questions/17750791/selecting-text-within-graphics-graphics2d](https://stackoverflow.com/questions/17750791/selecting-text-within-graphics-graphics2d) for the Java details

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [January 4, 2018, 4:19pm UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472/3 "2018-01-04T16:19:48Z")

</div>

You can also split this into a paintable canvas for the lines, and a template canvas for the boxes w/ text. Those templates can more easily copy the text on right click or something.

---

<div class="post-metadata">

**Author:** ![guanghui](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@guanghui](https://forum.inductiveautomation.com/u/guanghui)\
**Post date:** [January 5, 2018, 1:27am UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472/4 "2018-01-05T01:27:20Z")

</div>

It’s good idea,but hard to me…

---

<div class="post-metadata">

**Author:** ![guanghui](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@guanghui](https://forum.inductiveautomation.com/u/guanghui)\
**Post date:** [January 5, 2018, 1:27am UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472/5 "2018-01-05T01:27:57Z")

</div>

thanks,I will try it later.

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [January 5, 2018, 3:27pm UTC](https://forum.inductiveautomation.com/t/how-do-i-draw-some-strings-that-can-be-copied/16472/6 "2018-01-05T15:27:05Z")

</div>

I’ve done a lot with the paintable canvas, including selecting and moving items dynamically. Where is the string data and positions stored now? Are the positions hard-coded? What I do is copy the string and position to a dictionary, and then check the mouse position with event,getX() and event.getY() when I click the mouse, and then check to see which item is underneath that click, since you know the x/y and size of the label.
