import javax.swing.*; // swing class is placed in the javax.swing package
public class Main
{
public static void main(String[] args)
{
EmpetyFrame f = new EmpetyFrame();
// we create a sub class wd class name empetyframe
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// exit upon close event operation
f.setVisible(true);
// to show the frame main method calls setvisible method
}
}
class EmpetyFrame extends JFrame
{
public EmpetyFrame( )
// constructor sets size
{
setSize(default_width,default_height);
}
public static final int default_width = 300;
public static final int default_height = 300;
}
public class Main
{
public static void main(String[] args)
{
EmpetyFrame f = new EmpetyFrame();
// we create a sub class wd class name empetyframe
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// exit upon close event operation
f.setVisible(true);
// to show the frame main method calls setvisible method
}
}
class EmpetyFrame extends JFrame
{
public EmpetyFrame( )
// constructor sets size
{
setSize(default_width,default_height);
}
public static final int default_width = 300;
public static final int default_height = 300;
}
No comments:
Post a Comment