0

I want to add text to a rectangle drawn.

canvas.fillRect(...)

But I would like the user to enter custom text for this rectangle. But how can I create an editable label in gwt canvas that can take user input?

I want to achieve this in gwt canvas JAVA! Not JS.

Jarrod
  • 9,349
  • 5
  • 58
  • 73
membersound
  • 81,582
  • 193
  • 585
  • 1,120

2 Answers2

0

The drawstring method here might be of some use :)

http://www.c-point.com/javascript_vector_draw.htm

christopher
  • 26,815
  • 5
  • 55
  • 89
0

1) Create a JTextField with the same location as your Graphics.fillRect().

JTextField txtSomething = new JTextField(...)

2) Make the JTextField background transparent.

txtSomething.setBackground(new Color(0,0,0,0))

3) Run

There are other ways of doing this, try to research

Michael 'Maik' Ardan
  • 4,213
  • 9
  • 37
  • 60