The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
March 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Add a new component to frame during runtime

Posted by Pradyoth on March 26, 2001 at 3:01 PM

I want to add a new button to the frame every time user clicks the button.

I wrote the actionlistener class as
public void actionPerformed(ActionEvent e)
{
JButton b1 = new JButton("New");
getContentPane().add(b1);
}

and Added this actionlistener to the button.
The method action performed is getting executed but the button does not appear. Can anyone help?




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us