This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes pop up window help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "pop up window help" Watch "pop up window help" New topic
Author

pop up window help

cassie williams
Greenhorn

Joined: Apr 09, 2004
Posts: 5
hi there,
how do i have a pop up window(JFrame or some sort) upon clicking on a jbutton?
thanks
Amy Phillips
Ranch Hand

Joined: Apr 02, 2003
Posts: 280
Hi cassie,
I usually create a class which extends a JFrame and contains everything I want for my popup window. Then add an actionListener to the button you want to open the form. On the button being clicked I create an instance of my popup window form, call the method to make it do something and then call myform.show().
there are probably better ways but it works
[ April 12, 2004: Message edited by: Amy Phillips ]
 
Consider Paul's rocket mass heater.
 
subject: pop up window help