making the program wait

Hi There I have written a program that consists of a main GUI and another frame for entering details: I want the class with the main GUI in it to wait until the details in the other frame have been entered, but I dont know how to do this. I have tried Thread.wait() but this doesnt work as they seem to be in the same thread. I have been advised to use a modal dialog box but am not sure how to do this. My code is as follows:

publicvoid processStart()

{

if(startF!=null)

{

;// do nothing

}

else

{

p1 =new Player(this);

p2 =new Player(this);

startF =new StartFrame(p1, p2,this);

startF.setTitle("player information");

startF.setSize(450, 300);

startF.show();

this.repaint();

this.getContentPane().invalidate();

this.getContentPane().validate();

// the program should wait here until details are entered in the start frame before continuing with the code

if(startF.isSubmitted())

{

System.out.println("is submitted");

startF=null;

p1.moveChoose(this);

p2.moveChoose(this);

}

}

}

Any help would be most appreciated

[2027 byte] By [pollacchi] at [2007-9-30 15:08:31]
# 1
Look through the swing tutorial: http://java.sun.com/docs/books/tutorial/uiswing/index.htmland take note when you get to the event listeners section.Pete
PeteKirkham at 2007-7-5 22:04:01 > top of Java-index,Other Topics,Algorithms...
# 2
Dont crosspost... http://forum.java.sun.com/thread.jsp?thread=545453&forum=57&message=2653318
Ragnvald_id2 at 2007-7-5 22:04:01 > top of Java-index,Other Topics,Algorithms...
# 3

U haven't mention which components u r using... means awt or Swings.

If u r using awt..

create a class which extends Dialog like

class MyPlayer extends Dialog

{

//add a constructor

MyPlayer(Frame owner)

{

super(owner);

}

// here u write all required code ...

}

// class over

// ur main program means parent

then while u r calling... say

public void actionPerformed(ActionEvent ae)

{

MyPlayer mp=new MyPlayer(this);

mp.setSize(urWidth,urHeight);

mp.setVisible(true);

// after write the other codes-- the code from this line onwards will run only after disposing the dialog windo

}

Hope this will help u..

still having problem..

pls write...

cheers anvar

anvar_k at 2007-7-5 22:04:01 > top of Java-index,Other Topics,Algorithms...