Demo entry 6338981

entree clavier

   

Submitted by adrien on Dec 18, 2016 at 15:32
Language: Java. Code size: 890 Bytes.

	public static void createKeyboardHandler(RealtimeThread tache){
		// Creation AEH
		KeyboardAEHHandler clavierHandler = new KeyboardAEHHandler ();
		clavierHandler.setThread(tache);

		AsyncEvent eventClavier = new AsyncEvent();	// Création de l'AsyncEvent
		eventClavier.addHandler(clavierHandler);	// Liaison avec le Handler
		
		InputStreamReader isr;
		BufferedReader br;
		
		while(true)
		{
		   	    
			try {
			 
			   isr=new InputStreamReader(System.in);
			   br=new BufferedReader(isr);
			   buffer = br.readLine();				// Lecture de l'entrée clavier	      
			   System.out.println("Keyboard input received");
			   clavierHandler.setEntree(buffer); 	// Modification de l'attribut entree de la classe 
			   										// KeyboardAEHHandler
			   eventClavier.fire();					// Declenchement de l'evenement 
			
			} catch (IOException ioe) { }
		}

	}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).