Reputation: 11
I am making a project in which I have a class named runner_HMMPayl
from the main of this class I am initiating a JFrame0 f
instance. JFrame0
returns the values of text fields in JFrame0
that are then used in main.
I am facing a problem that when I instantiate the JFrame0
, it keeps on running and control is not shifted back to main of runner_HMMPayl
class. How can I do that?
These are the relevant code snippets.
First one is the main, making JFrame0
instance.
public static void main(String[] args) throws IOException
{
JFrame0 f = new JFrame0();
f.Start(f);
System.out.println("f closed"); //not displayed in console----------
System.out.println("First argument" + args[0]); //not displayed in console-
}
This is the code of the JFrame0
button, which upon pressing should return the arguments.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
argA[0]= "1";
String s1 = jTextField1.getText();
argA[1] = s1;
String s2 = jTextField7.getText();
argA[2] = s2;
// ..
String s7 = jTextField2.getText();
argA[7] = s7;
runner.configureHMMPayl(argA); //function in runner_HMMpayl class (instance:runner)
runner.giveArgs(argA); //function in runner_HMMpayl class
}
I am not able to figure it out.
Upvotes: 0
Views: 221
Reputation: 347314
Use a modal JDialog
to stop execution until the dialog is closed.
See How to make Dialogs for more details.
And while you're at it, check out Initial Threads
Upvotes: 2