Check out example codes for "java awt tutorial". It will help you in understanding the concepts better.

Code Example 1

import java.awt.*;
/* We have extended the Frame class here,
 * thus our class "SimpleExample" would behave
 * like a Frame
public class SimpleExample extends Frame{
        Button b=new Button("Button!!"); 
        // setting button position on screen
        //adding button into frame 
        //Setting Frame width and height
        //Setting the title of Frame
        setTitle("This is my First AWT example"); 
        //Setting the layout for the Frame
        setLayout(new FlowLayout());
        /* By default frame is not visible so 
         * we are setting the visibility to true 
         * to make it visible.
    public static void main(String args[]){  
         // Creating the instance of Frame
         SimpleExample fr=new SimpleExample();  

Code Example 2

import java.awt.*;
public class Example2 {
      //Creating Frame    
      Frame fr=new Frame();       
      //Creating a label
      Label lb = new Label("UserId: "); 
      //adding label to the frame
      //Creating Text Field
      TextField t = new TextField();
      //adding text field to the frame
      //setting frame size
      fr.setSize(500, 300);  
      //Setting the layout for the Frame
      fr.setLayout(new FlowLayout());
   public static void main(String args[])
       Example2 ex = new Example2(); 

Learn ReactJs, React Native from