Presentation is loading. Please wait.

Presentation is loading. Please wait.

GUI Programming using Java - Key Events

Similar presentations


Presentation on theme: "GUI Programming using Java - Key Events"— Presentation transcript:

1 GUI Programming using Java - Key Events
Department of Computer and Information Science, School of Science, IUPUI GUI Programming using Java - Key Events Dale Roberts, Lecturer Computer Science, IUPUI

2 11.16 Key-Event Handling KeyListener interface For handling KeyEvents
Declares methods keyPressed, keyReleased and keyTyped

3 Outline KeyDemoFrame .java (1 of 3) Implement KeyListener interface
Set background color Register application as event handler for itself

4 Get code of released key
Outline Declare keyPressed method Get code of pressed key KeyDemoFrame .java (2 of 3) Declare keyReleased method Get code of released key Declare keyTyped method Get character typed

5 Outline KeyDemoFrame .java Test if it was an action key
Determine any modifiers pressed

6 Outline KeyDemo.java (1 of 2)

7 Outline KeyDemo.java (1 of 2)

8 Acknowledgements Deitel, Java How to Program


Download ppt "GUI Programming using Java - Key Events"

Similar presentations


Ads by Google