Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
About pop up a window
rose deng
Ranch Hand
Posts: 78
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi.
I want to do following thing,but not want to use Swing.When i click a button in the
applet
,a window will pop up.
Thanks for your help in advance.
Nathan Pruett
Bartender
Posts: 4121
I like...
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Rose
,
Here is an example of what you want to do:
import java.applet.*; import java.awt.*; import java.awt.event.*; public class TestFrameApplet extends Applet implements WindowListener, ActionListener { Frame fr; Button bt; public void init() { fr = new Frame(); fr.setSize( 200, 200 ); fr.addWindowListener( this ); bt = new Button( "Open!" ); bt.addActionListener( this ); add( bt ); } public void actionPerformed( ActionEvent e ) { if( e.getSource() == bt ) { fr.setVisible( true ); } } public void windowClosing( WindowEvent e ) { if( e.getSource() == fr ) { fr.setVisible( false ); } } public void windowClosed( WindowEvent e ) {} public void windowIconified( WindowEvent e ) {} public void windowDeiconified( WindowEvent e ) {} public void windowOpened( WindowEvent e ) {} public void windowActivated( WindowEvent e ) {} public void windowDeactivated( WindowEvent e ) {} }
HTH,
-Nate
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
javascript:window.close() not working in firefox
Struts action triggered by onUnload event
Struts action triggered by onUnload event
jquery-struts2
Pop up window issue
More...