Hour 15. Responding to User Input

The graphical user interface you developed during the past two hours can run on its own without any changes. Buttons can be clicked, text fields filled with text, and the window can be resized with wild abandon. Sooner or later, even the least discriminating user is going to be left wanting more. The graphical user interface that a program offers has to cause things to happen when a mouse-click or keyboard entry occurs. Text areas and other components must be updated to show what's happening as the program runs. These things are possible when your Java program can respond to user events. An event is something that happens when a program runs, and user events are things a user causes to happen by using the mouse, keyboard, or another input device. Responding to user events often is called event handling, and it's the activity you'll be learning about during this hour. The following topics will be covered:

  • Making your programs aware of events
  • Setting up a component so it can cause events
  • Ignoring some components
  • Finding out where events end up in a program
  • Storing information in the interface
  • Converting values stored in text fields
      
Comments