0

enter image description here

Can anybody say to me, why it can appear? When Thread is working, it happens.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Aero
  • 19
  • 1
  • 7
  • I agree, but AWT_TextField have method ValueChanged, JTextField doesn't have it, but i NEED it:( Thanks for asking;) – Aero Apr 28 '14 at 20:35
  • Use a `JTextField` and add a `DocumentListener`. – Andrew Thompson Apr 28 '14 at 22:02
  • Don't block the EDT (Event Dispatch Thread) - the GUI will 'freeze' when that happens. Instead of calling `Thread.sleep(n)` implement a Swing `Timer` for repeating tasks or a `SwingWorker` for long running tasks. See [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) for more details. – Andrew Thompson Apr 29 '14 at 07:33

1 Answers1

0

That's because AWT and Swing are rendered in a different manner. It's not recommended mixing both AWT and Swing components.

You can learn more about it here:

http://www.comp.nus.edu.sg/~cs3283/ftp/Java/swingConnect/archive/tech_topics_arch/mixing/mixing.html

Swing and AWT Mixing is bad, but still done, why?

mixing awt and swing in GUI programming using Java

Community
  • 1
  • 1
angel_navarro
  • 1,757
  • 10
  • 11