Friday, 3 April 2015

Create a Frame In java

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;
}

No comments:

Post a Comment

Grammar Mistakes in Technical Paper Writing

Let me share some experience in this post with you. I'm currently in the second year of my Ph.D. program. We are in the middle of paper...