Results 1 to 2 of 2

Thread: cancel window close

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    cancel window close

    You know how, in VB, you can cancel the closing of a window by using the Form_Unload event and setting Cancel = True. How could I accomplish the same thing using a JFrame?

    Thanks
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    This will stop the window closing. Use it when you've extended a JFrame.
    Code:
    addWindowListener(new WindowAdapter() 
    {
    	public void windowClosing(WindowEvent e) 
    	{
    	}
    });
    If you haven't extended a JFrame use

    Code:
    frameName.addWindowListener(new WindowAdapter() 
    {
    	public void windowClosing(WindowEvent e) 
    	{
    	}
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width