开发者

install timer component in netbeans?

开发者 https://www.devze.com 2023-03-02 17:05 出处:网络
id like to install a timer component in netbeans much like the timer component for VB.net in visual studio but i can\'t seem to find one an开发者_开发技巧ywhere.There are few components that cannot be

id like to install a timer component in netbeans much like the timer component for VB.net in visual studio but i can't seem to find one an开发者_开发技巧ywhere.


There are few components that cannot be added directly from the component pane of netbeans. Even i had the same problem when i had to work with the timers but there is no way for me to find one. So i started writing codes on my own. And its not hard to add timers into your application in code method as it does not need any location in the window. You just have to create a timer object and use it in your codes as simple as that. If you need to know how to create timers you can have a look at swing timers

--EDIT-- I dont have working example of swing timer but the code below shows the java util timer

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class timer_utility {
    public static void start_timer() {
        final Timer _iTimer;        
        _iTimer = new Timer(true);
        _iTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                //timer task to be executed goes here.
            }
        }, 1000, 1000);         
    }
}

--EDIT--

Have a look at this link

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号