Tuesday 24 June 2014

Creating a new frame

import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class Framecreation extends Frame implements WindowListener{
Framecreation()
{
this.setVisible(true);
this.setSize(200, 200);
this.setTitle("mine");
this.addWindowListener(this);
}

public static void main(String[] args) {
new Framecreation();

}

public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}

public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub

}

}

output:


No comments:

Post a Comment

SAY HELLO!!