I make my first consultation available and in advance I appreciate the future answers.
To start I have a form that contains 2 jcombobox
:
jcbSerie
and jcbPartido
.
The form integrates
Runnable()
In the form variables I have a Thread
and a int
:
Thread Serie = new Thread();
int opt = 1;
When the form is initialized, it executes:
Serie.start();
I initialize it with start()
because I am informed that the difference with run()
is that it is executed asynchronously.
In the fragment run()
< = method of execution , there is the code to execute which has the following format:
@Override
public void run() {
switch (opt) {
case 1:
MetodoEjecutado1();
break;
case 2:
MetodoEjecutado2();
break;
case 3:
break;
}
}
Then, as expected, conditional 1 is executed when the form is executed. But my query is as follows: How or what is the way in which conditional 2 should execute the run()
from jcbPartido
. To be more precise:
Execute the Executed Method1 () only once and the thread is no longer available or destroy it (I am new I am willing to read the answers);
In the jcbSerie item change event, if you select a different value than the "Select option" option, unblock the jcombobox jcbPartido.
When changing the item in jcbPartido the variable% co_of% that is worth 1 changes to
opt
, then how can I execute the run () method that only executes once only Method2 () asynchronously, and like the first part, to die or stop when you finish.
Thank you very much for your time!