Write a program to initialise the Frame
· Set the title as MyPanel
· Set the visiblity as true
· Set size from the coordinate axis as (300,300)
· SetLocation(100,100).
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends Frame
{
Frame1()
{
setTitle("My Panel");
setSize(300,300);
setLocation(100,100);
setVisible(true);
addWindowListener(new WindowListener(){
public void windowClosed(WindowEvent arg0) {
System.out.println("Window close event occur");
}
public void windowDeactivated(WindowEvent we){
}
public void windowActivated(WindowEvent we){
}
public void windowDeiconified(WindowEvent we){
}
public void windowIconified(WindowEvent we){
}
public void windowClosing(WindowEvent we){
}
public void windowOpened(WindowEvent we){
}
});
show();
}
public static void main(String []args)
{
Frame1 p=new Frame1();
}
}
· Set the title as MyPanel
· Set the visiblity as true
· Set size from the coordinate axis as (300,300)
· SetLocation(100,100).
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends Frame
{
Frame1()
{
setTitle("My Panel");
setSize(300,300);
setLocation(100,100);
setVisible(true);
addWindowListener(new WindowListener(){
public void windowClosed(WindowEvent arg0) {
System.out.println("Window close event occur");
}
public void windowDeactivated(WindowEvent we){
}
public void windowActivated(WindowEvent we){
}
public void windowDeiconified(WindowEvent we){
}
public void windowIconified(WindowEvent we){
}
public void windowClosing(WindowEvent we){
}
public void windowOpened(WindowEvent we){
}
});
show();
}
public static void main(String []args)
{
Frame1 p=new Frame1();
}
}
0 comments:
Post a Comment