Professional Documents
Culture Documents
• Text controls
– JTextField
– JPasswordField
– JTextArea
– JEditorPane
– JTextPane
• Graphic controls
– JTree
– JTable
– JToggleButton
UI Editor
Applications
Navigator Shortcut menu
Shortcut menu
Click
when
menu bar
right-clicking a
object in
menu item
Structure pane
to display
menu bar.
• How it works:
– Event originates from source and generates an
event object.
– An event listener hears a specific event.
– An event handler determines what to do.
• Setting it up:
1. Create an event source object.
2. Create an event listener object implementing an
interface with methods to handle the event object.
3. Write an event-specific method to handle the event.
4. Register the listener object with the event source
for the specified event.
Source
Event listener object
OK
Handler method
Source
Event listener object
OK
Notified Handler method
Source
Event listener object
OK Handler method:
Source
save changes and quit
• Model-View-Controller principles
Event Controller
modify View
View
Event handler
methods
void findButton_actionPerformed(ActionEvent e) {
// Your code to handle the ActionEvent
}