JAVA GUI PROGRAM TO CREATE A FRAME AND ADD BUTTON ,WHEN USER CLICK ON BUTTON SHOW "WELCOME" on August 20, 2020 Get link Facebook X Pinterest Email Other Apps WAP in java to create a gui frame and add a button when user click on button set into text field a "welcome" import java.awt.*;import java.awt.event.*;class ButtonExample extends Frame implementsActionListener{ TextField t1; Button b; public ButtonExample(){ t1=new TextField(); b= new Button("Click"); this.setVisible(true); this.setSize(200,200); this.setLocation(100,100); this.setLayout(null); this.setResizable(false); //setbounds t1.setBounds(30,40,80,40);b.setBounds(50,90,50,20);b.addActionListener(this); //addingthis.add(t1);this.add(b);} PROGRAM CODE-- OUTPUT OF ABOVE PROGRAM-- Comments
Comments
Post a Comment