Saturday, 8 June 2013

Talha First Program of Java Swing

Talha a very intelligent student who makes the first program in Java when he started the Java Swing ,


I hope he will happy to see this shared code ...
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