Java AWT: Button Events and Arrow Key Shape Movement
Classified in Computers
Written on in English with a size of 3.75 KB
Button Click Action Events
import java.awt.*;
import java.awt.event.*;
public class ButtonClickActionEvents
{
public static void main(String args[])
{
Frame f=new Frame("Button Event");
Label l=new Label("DETAILS OF PARENTS");
l.setFont(new Font("Calibri",Font.BOLD, 16));
Label nl=new Label();
Label dl=new Label();
Label al=new Label();
l.setBounds(20,20,500,50);
nl.setBounds(20,110,500,30);
dl.setBounds(20,150,500,30);
al.setBounds(20,190,500,30);
Button mb=new Button("Mother");
mb.setBounds(20,70,50,30);
mb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
nl.setText("NAME: " + "Aishwarya");
dl.setText("DESIGNATION: " + "Professor");
al.setText("AGE: " + "42");
}
});
Button fb=new Button("Father");
fb.setBounds(80,70,50,30);
fb.addActionListener(