CLICK HERE TO EARN MONEY FREE

Sunday, January 13, 2013

CREATE A BUTTON IN JAVA


import java.awt.*; 
import java.awt.event.*;
 

public class ButtonText 
  public static void main(String[] args) {
  Frame frame=new Frame("Button Frame");// method
  Button button = new Button("Submit"); // button name
  frame.add(button)
  frame.setLayout(new FlowLayout());// for position
  frame.setSize(200,100);//size
  frame.setVisible(true);
  frame.addWindowListener(new WindowAdapter(){//action listner
  public void windowClosing(WindowEvent e){
  System.exit(0);
  }
  });
  }
}
Output this program:
  

0 comments:

Post a Comment

 

TEKONOLOGY Copyright © 2011 -- Template created by TEKONOLOGY -- Powered by Blogger