Sunday, 18 December 2022

Write a program to create three buttons with caption ok , reset, and cancel;

 


SWING 


import java.awt.*;

class But {
    But() {
        Frame f = new Frame();
        Button b1 = new Button("Ok");
        b1.setBounds(100, 50, 50, 50);
        f.add(b1);
        Button b2 = new Button("Reset");
        b2.setBounds(100, 101, 50, 50);
        f.add(b2);
        Button b3 = new Button("Cancel");
        b3.setBounds(100, 150, 80, 50);
        f.add(b3);
        f.setSize(500, 500);
        f.setLayout(null);
        f.setVisible(true);
    }

    public static void main(String a[]) {
        new But();
    }
   }

OUTPUT:




No comments:

Post a Comment

GitHub Most Imp Command For Every Developer Learn:

 Top Command for GitHub:  1) git clone 2) git init and git status   3) git add file name  or git add .  4) git commit -m message  5) git rem...