ممكن اتساعدوني بحل هذا سؤال لنا بصراحه ماعرفت احله ؟
اقتباسWrite a Java applet that includes a single TextField. When the user types somethinginside the TextField and hits the enter key, whatever was typed in the TextField should
be printed to the console (i.e. using System.out.println()).
Remember the TextField class defines a method called getText() that returns a String
representing the text typed in the TextField.
وهذي محاولتي بس بائت بالفشل
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class AWT2003 extends Applet implements ActionListener {
TextField x= new TextField(30);
public void init() {
add(x);
}
public void actionPerformed (ActionEvent e) {
if (e.getSource() instanceof TextField) {
TextField B = (TextField) (e.getSource());
if (B==x)
System.out.println(x.getText());}
}
}وشكرا لكم