HCF Using Applet:: 1. Without Using Button - After Giving Input Press Enter
HCF Using Applet:: 1. Without Using Button - After Giving Input Press Enter
import java.awt.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.applet.*;
add(l1);
add(t1);
add(l2);
add(t2);
add(l3);
add(t3);
add(b);
b.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == b)
{
int n1 = Integer.parseInt(t1.getText());
int n2 = Integer.parseInt(t2.getText());
int res=hcf(n1,n2);
t3.setText(" " +res);
}
}