CS141: Topics for Nov 18, 20, & 22, 2013
Homework and Reading
The reading and homework for this week can be found here: Lab 13
Chp 9
Continue discussion of chapter 9 from last week.
In particular, what is the difference between a class, an abstract class, and an interface?
These concepts will be used a lot in developing your graphical user interfaces.
Chp 10 Vocabulary
Events
Event Loop
Event Queue
Listening to Events
Event listeners
Event source
Event Handling
|
GUI Components - JComponents
Local Inner classes
Anonymous Inner classes
Components: Text Fields, Text Areas
JComponent, paintComponent
RGB Color
|
Topics: Chp 10 - Graphical User Interfaces
- Java libraries for graphical user interfaces (GUI):
- AWT (older)
- Swing
- There are good online references, such as JFC/Swing
Be careful, some of these may be a little bit out of date.
- Window based programs.
- In Java, we use a specialized
top-level container called a
JFrame.
(JApplet and JDialog are also top level containers)
- All other components must be placed in a top level container.
- Other components include: buttons, text boxes, labels, etc
- Events:
- What is an event - clicking a mouse button, pressing a key on keyboard, etc
- What is an event loop?
- Your program "listens" and responds to events using what we call event listeners.
- How do you add event listeners to your program - see examples.
- Drawing
- Must extend JComponent
and override the paintComponent() method.
- Graphics class has many drawing primitives and capabilities
- RGB Color on the computer
Try experimenting with RGB vs HSV
- Using Netbeans to generate a user interface.