A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Simple example of AWT by association method:

// first use AWT package
import.awt.*;

//create class
class Diamond2{
Diamond2(){
Frame f = new Frame();
                            
Button b=new button(“click me”);
// the setBounds( int x-axis, int y-axis, int width, int height) method is using in this example that sets the position of awt button.
//set button position
b.setBounds(35, 120, 85, 30);

//
f.add(b);
f.setSize(280,280);
f.setLayout(null);
f.visible(true);
}

public static void main(String args[])
{
            Diamond2 f =new Diamond2();
}

}

LEARN TUTORIALS

.

.