Create a simple swing frame


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

    public class ws extends JFrame
    {
         Container c;
         public ws(String title)
          {
               super("Frame");
               c=this.getContentPane();
               c.setBackground(Color.pink);
               setSize(300,400);
               addWindowListener(new f1());
               setDefaultCloseOperation(DISPOSE_ON_CLOSE);
               show();
          }
        class f1 extends WindowAdapter
          {
                 public void windowClosed(WindowEvent e)
                        {
                                 System.exit(0);
                        }
          }
                public static void main(String args[])
                        {
                                  ws w=new ws("frame 1");
                        }        
}

Related Posts Plugin for WordPress, Blogger...

Engineering material

GTU IDP/ UDP PROJECT

GTU IDP/ UDP PROJECT

Patel free software download

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP