WindowEvent

Google Advertisements

Prev Tutorial Next Tutorial

Event Handling for Window

Event handling for window you need WindowEvent and WindowListener interface.

Event classListener Interface
WindowEventWindowListener

Method (abstract method)

public void windowOpened(WindowEvent e): This method will be execute if the window is open.

public void windowClosing(WindowEvent e): This method will be execute if the window is going to be closed.

public void windowClosed(WindowEvent e): This method will be execute if the window is already closed.

public void windowActivate(WindowEvent e): This method will be execute if the window is in selected state.

public void windowDeactivated(WindowEvent e): This method will be execute if the window is not in selected state.

Example of ItemEvent

import java.awt.*;
import java.awt.event.*;

class A extends Frame 
{
A()
{
setTitle("Insurance Managment Sysytem");
setBackground(Color.cyan);
setLayout(null);
   
 addWindowListener(new WindowAdapter()
{
  public void windowClosing(WindowEvent we)
{
  System.exit(0);
  }
  });

setSize(500,300);
setVisible(true);
}  //constructor
}  // class

class WindowEventEx
{
public static void main(String s[])
{
A obj=new A();
}
}	

Download code Click

window close example
Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs