want to append information onto a file based on user selection of minutes (1 min, 15, 30, 45min etc) through radio buttons. for each radio button there are case in switch statement. I am finding it difficult to update the file on a regular interval, continously, does anyone know how to do it based on whatever minute has been chosen. time_int is current time, update_point is the next interval point in which the file needs to be updated? so please help with the UPDATEFILE() method.

]public void radioStartTime(int t) {

    time_int = System.currentTimeMillis(); //time radio button is clicked, clock      the time on click
    System.out.println(sdf.format(time_int));

    /* a case/situation for different radio button selected*/
    switch (t) {

    case 1:
        update_point = time_int + (1*60000);
        System.out.println(sdf.format(update_point));
        UPDATEFILE????(1);
    break;

.....

Recommended Answers

All 3 Replies

update the file on a regular interval,

Look at using the Timer class. It can call your update method on a regular interval.

it didn't even execute once when I tested it? Can you how me how?

Write a small program to test how to use the javax.swing.Timer class and post it here if you have problems getting it to work.
I think the API doc has a sample of how to use it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.