الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

java GUI ممكن احد يساعدني بحل هالمشكله

مغلق
بدأه CS25 في 6 يناير 2007 · 1 رد · 638 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

ممكن اتساعدوني بحل هذا سؤال لنا بصراحه ماعرفت احله ؟

اقتباس
Write a Java applet that includes a single TextField. When the user types something

inside 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());}

}

}

وشكرا لكم

تم تعديل هذه المشاركة بواسطة CS25 في 6 يناير 2007 في 00:27

#2
public class AWT2003 extends Applet implements TextListener {

	TextField x = new TextField(30);

	public void init() {
		add(x);
		x.addTextListener(this);
	}

	public void textValueChanged(TextEvent event) {
		TextField tf = (TextField) event.getSource();
		System.out.println("textValueChanged: " + tf.getText());
	}

}

لست متواجد بشكل يومي

هذا الموضوع مغلق.

مواضيع مشابهة