Thursday, 14 July 2011

create a simple frame in java swing

This is a simple java program to create a simple frame in java using swing. I will explain swing in detail later. Try this program and create a simple frame.


import java.awt.*;
import javax.swing.*;


Class Myframe extends JFrame{

public Myframe()
{
setTitle("Simple example");
       setSize(300, 200);
       setLocationRelativeTo(null);
       setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String [] args)
{
Myframe a=new Myframe();
a.setVisible(true);
}


}

0 comments:

Post a comment