Why are there two Timer classes in Java(one under javax.swing, one under java.util )?

前端 未结 5 1721
轮回少年
轮回少年 2020-12-09 19:59

I am really confused about this . Java has two Timer classes, one under swing , and one under util ... why is that? Which one should I use if I want to simply run X every

5条回答
  •  抹茶落季
    2020-12-09 20:29

    You're kind of correct. It's recommended that if you're going to do UI work that will be affected by a timer you should use the swing component. The util timer cannot set UI elements itself. Here is a nice comparison.

提交回复
热议问题