OK, now to make your second button do something different from the first button: we will make it hide the second frame! What you have to do is this:
A) add an if statement to your actionPerformed method, so that the program can can distinguish between the two buttons
B) make it so that the second button can can HIDE the second frame
Here's all you need to do to make that happen:
REPLACE EVERYTHING IN YOUR ACTION PERFORMED METHOD WITH THIS CODE BLOCK:
if (e.getSource( )== btn )
{
sayWhat = typeText.getText( );//get the text in textfield
System.out.println(sayWhat); //pass it to console
System.out.println("JAVA IS WAY BETTER THAN VB!");
}
else if (e.getSource( )== peek )
{
wazzup.hide( ); //hide the second frame
}//end if statement
th-th-thats all folks!
Uncle Paulie
Friday, February 6, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment