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

Thread

بدأه ARRA في 22 مايو 2008 · 4 رد · 816 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

أود أن أعرف كيف أضيف thread لهذا الكود ..

 

 public void commandAction(Command command, Displayable displayable) {
		// write pre-action user code here
		if (displayable == SplashScreen) {
			if (command == SplashScreen.DISMISS_COMMAND) {
				// write pre-action user code here
				switchDisplayable(null, getMenu());
			// write post-action user code here
			}
		} else if (displayable == ThankEnd) {
			if (command == exitCommand) {
				// write pre-action user code here
				exitMIDlet();
			// write post-action user code here
			}
		} else if (displayable == info) {
			if (command == Submit) {

				try{
			   customer newCustomer = new customer();
							//newCustomer.setCustomerorder(foodListMessage);

							//NewWebServiceService_Stub s = new NewWebServiceService_Stub();
							String sname = textField1.getString();
							String sphone = textField2.getString(); 
							String splace = textField3.getString();
						   // s.addCustomer(sname);
							newCustomer.setCustomerorder(sname);
							newCustomer.setCustomerorder(sphone);
							newCustomer.setCustomerorder(splace);
							//String o = foodStub.addCustomer(sname);
							//newCustomer.setPlace(foodListMessage);

							boolean test = foodStub.addCustomer(newCustomer);
						   // System.out.print(test);
				} catch (RemoteException ex) {
							ex.printStackTrace();
						}
				switchDisplayable(null, getThankEnd());
			// write post-action user code here
			} else if (command == backCommand2) {
				// write pre-action user code here
				switchDisplayable(null, getMenu());
			// write post-action user code here
			}
		} else if (displayable == menu) {
			if (command == cancelCommand) {
				// write pre-action user code here
				exitMIDlet();
			// write post-action user code here
			} else if (command == okCommand) {
				// write pre-action user code here
				System.out.println("hello");
				ChoiceGroup cg = (ChoiceGroup) menu.get(0);
				boolean[] bb = new boolean[cg.size()];
				cg.getSelectedFlags(bb);
				for (int i = 0; i < cg.size(); i++) {
					System.out.println(cg.getString(i) + bb);


					/*if (bb == true) {
						try {

							customer newCustomer = new customer();
							newCustomer.setCustomerorder(foodListMessage);

							String sname = textField1.getString();
							String sphone = textField2.getString(); 
							String splace = textField3.getString();

							newCustomer.setName(sname);
							newCustomer.setPhone(sphone);
							newCustomer.setPlace(splace);
							//newCustomer.setPlace(foodListMessage);

						   boolean test = foodStub.addCustomer(newCustomer);
						} catch (RemoteException ex) {
							ex.printStackTrace();
						}
					}*/
				}

				switchDisplayable(null, getInfo());
			// write post-action user code here


			}
		} else if (displayable == order) {
			if (command == List.SELECT_COMMAND) {
				// write pre-action user code here
				orderAction();
			// write post-action user code here
			} else if (command == backCommand1) {
			// write pre-action user code here

			// write post-action user code here
			} else if (command == okCommand2) {
			// write pre-action user code here

			// write post-action user code here
			}
		} else if (displayable == waitScreen) {
			if (command == WaitScreen.FAILURE_COMMAND) {
			// write pre-action user code here

			// write post-action user code here
			} else if (command == WaitScreen.SUCCESS_COMMAND) {
				// write pre-action user code here
				switchDisplayable(null, getMenu());
			// write post-action user code here
			}
		}
	// write post-action user code here
	}

تم تعديل هذه المشاركة بواسطة ARRA في 22 مايو 2008 في 14:03

#2

فصل في مشكلتك

أين تضيف إضافة الخيوط thread

هل هناك أسباب تدفعك إلى ذلك

كما أني لا أرى أمامي شيفرة كاملة

وإنما أجزاء من شيفرة

فهل تتوقع أن الجميع هنا سيساعدك

لا أظن

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

#3
alaadiaa كتب:
فصل في مشكلتك

أين تضيف إضافة الخيوط thread

هل هناك أسباب تدفعك إلى ذلك

كما أني لا أرى أمامي شيفرة كاملة

وإنما أجزاء من شيفرة

فهل تتوقع أن الجميع هنا سيساعدك

لا أظن

تحياتي

أريد أضيفه لهذه الجزئية

		   try{
				customer newCustomer = new customer();
							 //newCustomer.setCustomerorder(foodListMessage);

							 //NewWebServiceService_Stub s = new NewWebServiceService_Stub();
							 String sname = textField1.getString();
							 String sphone = textField2.getString(); 
							 String splace = textField3.getString();
							// s.addCustomer(sname);
							 newCustomer.setCustomerorder(sname);
							 newCustomer.setCustomerorder(sphone);
							 newCustomer.setCustomerorder(splace);
							 //String o = foodStub.addCustomer(sname);
							 //newCustomer.setPlace(foodListMessage);

							 boolean test = foodStub.addCustomer(newCustomer);
							// System.out.print(test);
				 } catch (RemoteException ex) {
							 ex.printStackTrace();
						 }

هل يستلزم علي وضع الكود كاملاً من بدايته ؟ فهو طويل جداً

تم تعديل هذه المشاركة بواسطة ARRA في 22 مايو 2008 في 15:49

#4

اعمل الكلاس extends Thread

في الداله رن run ضع الكود الذي تريده يكون لاكثر من زبون

#5
Xline كتب:
اعمل الكلاس extends Thread

في الداله رن run ضع الكود الذي تريده يكون لاكثر من زبون

ممكن توضح أكثر ؟

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