java - Putting text from JTextField to JLabel -


i 'm working on code takes string jtextfield , puts on jlabel.

but problem string shown missing last character.

 private void jtextfield1keytyped(java.awt.event.keyevent evt)     {       string  ch=jtextfield1.gettext();       jlabel1.settext(ch); }  

enter image description here

it's better use documentlistener check changes in jtextfield. not notify after changes of additional character incorporated, notified changes unrelated keyboard events (e.g. pasting text).


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -