OK, now that you have two frames, how's about we do something with them? For starters, lets make it possible for a button on one frame to make another frame hide itself. Here is how you do it:
A) Declare a second button by adding this line
Button peek;
right below this line
Button b;
B) Add this second button to your first frame by adding this block of code into your constructor:
peek = new Button("PEEKABOO!"); //declare button
peek.addActionListener(this); //give it some action
f1.add(peek); //add to frame
C) SAVE, COMPILE THEN RUN THE PROGRAM. Both buttons should do the same thing; we will fix that in the final blog post
Cheers,
Uncle Paulie
Thursday, February 5, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment