Tuesday, 4 June 2013

First Program Using AWT

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package talha;
import java.awt.*;
/**
*
* @author Saeed
*/
public class Talha {
Frame f;
Button bok,bcancel;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new Talha();

}
Talha(){
f=new Frame("My Talha Frame");
bok=new Button("Ok");
bcancel=new Button("Cancel");
f.setLayout(null);
bok.setBounds(30, 70, 120, 40);
bcancel.setBounds(200, 70, 120, 40);
bok.setBackground(new Color(194,78,194));
f.add(bok);
f.add(bcancel);
f.setVisible(true);
f.setSize(400,400);
}
}

No comments:

Post a Comment