Graphic Programming with Inheritance
- Chapter 4: Create drawings by by implementing Icon
interface type
- Now: Form subclass of JPanel
public class MyPanel extends JPanel
{
public void paintComponent(Graphics g)
{
drawing instructions go
here
}
...
}
- Advantage: Inherit behavior from JPanel
- Example: Can attach mouse listener to JPanel
previous |
start |
next .... [Slide 17] ....