You are on page 1of 2

MODULO 11

GUI EVENT HANDLING


EVALUACIN DEL APRENDIZAJE
Nombre: ____________________________________________________
Fech: __________e!m"#: ______________________________________
T"em$o $r re%o#&er#o: 1' m"()*o%+
1+ ,h* "% ( e&e(*-
.e#ec* (/ 1 o$*"o(:
a) An event is what happens when the user manipulates a Windows control,
whether that control be a pushbutton, a radio button, a slider or many other
such controls.
b) An event is created automatically by the components of a window.
c) An event success when you execute your application program.
d) A component has only one event.
0+ ,h* "% ( e&e(* h(1#er-
.e#ec* (/ 1 o$*"o(:
a) Is a characteristic of the GUI components.
b) An event handler is a software method provided by programmers such as
you and me, that the perating !ystem calls to handle a particular event.
c) Allow the users to see the GUI.
d) Adds echo character to hide text input in component.
2+ ,h* 3"## h$$e( 3he( /o) **em$* *o com$"#e (1 r)( *h"% co1e+ .e#ec*
(/ o(e o$*"o(+
""#emonstration of event handling
import $ava.awt.event.%&
import $ava.awt.%&
public class 'yWc extends (rame implements Window)istener*
public static void main+!tring argv,-)*
'yWc mwc . new 'yWc+)&
/
public void window0losing+Window1vent we)*
!ystem.exit+2)&
/""1nd of window0losing
public void 'yWc+)*
set!i3e+422,422)&
set5isible+true)&
/
/""1nd of class
a) 1rror at compile time
b) 5isible (rame created that that can be closed
c) 0ompilation but no output at run time
d) 1rror at compile time because of comment before import statements
4+ ,h"ch o5 *he 5o##o3"(6 re correc* e&e(* h(1#"(6 me*ho1%+
.e#ec* (/ 0 o$*"o(%+
a) mouse6ressed+'ouse1vent e)*/
b) 'ouse6ressed+'ouse0lic7 e)*/
c) function8ey+8ey6ress 7)*/
d) componentAdded+0ontainer1vent e)*/
'+ ,h"ch o5 *he 5o##o3"(6 %**eme(*% re correc*-
.e#ec* (/ 0 o$*"o(%+
a) If multiple listeners are added to a component only events for the last
listener added will be processed
b) If multiple listeners are added to a component the events will be processed
for all but with no guarantee in the order
c) Adding multiple listeners to a component will cause a compile time error
d) 9ou may remove as well add listeners to a component.

You might also like