Advertisement
Hasan1026

AWT WINDOW

Mar 8th, 2022
1,365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.awt.*;
  3. public class test extends Frame {
  4.     test() {
  5.         Button b = new Button("Click Me!!");
  6.  
  7.         b.setBounds(200, 100, 500, 30);
  8.  
  9.         //adding button into frame
  10.         add(b);
  11.  
  12.         // frame size 300 width and 300 height
  13.         setSize(900, 900);
  14.  
  15.         // setting the title of Frame
  16.         setTitle("This is our basic AWT example");
  17.  
  18.         // no layout manager
  19.         setLayout(null);
  20.  
  21.         // now frame will be visible, by default it is not visible
  22.         setVisible(true);
  23.     }
  24.     public static void main(String[] args) {
  25.         test f = new test ();
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement