0

I am struggling with getting a chronometer into a jLabel or jTextfield. My first class is a GUI Where I will want to display the chronometer in a jLabel or JTextField. My second class is where I made the chronometer, which works fine showing it on the console. My question is how can I make the run() method of the chronometer to change the jLabel of the GUI class instead of showing in the console.

Chronometer class:

    public void run()
    {
    increaseTime();
    Paciente.tfTime.setText((getTime()));
    }  

GUI class(Paciente):

private void bStartActionPerformed(java.awt.event.ActionEvent evt) {                                       
            setTime();
}

public void setTime(String time)
{
    Timer timer = new Timer();
    Chronometer chron = new Chronometer();
    timer.schedule(chron, 1000, 1000);
}

Thanks

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Gabriel Luque
  • 117
  • 11

0 Answers0