简体   繁体   English

使用计时器增加 JTextField 中的值

[英]Incrementing a value in a JTextField with a timer

How do I go about making a timer that will increment the time in a JFormattedTextField?我如何 go 关于制作一个计时器来增加 JFormattedTextField 中的时间?

Look at http://download.oracle.com/javase/6/docs/api/javax/swing/Timer.htmlhttp://download.oracle.com/javase/6/docs/api/javax/swing/Timer.html

This lets you execute an ActionListener repeatedly in the Swing event thread with a specified delay.这使您可以在 Swing 事件线程中以指定的延迟重复执行 ActionListener。

The just get and set the value from the textfield.只需从文本字段中获取和设置值。

Edit: not a Runnable but an ActionListener编辑:不是 Runnable 而是 ActionListener

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM