SE450
:
Graphic Programming with Inheritance
[17/65]
Chapter 4: Create drawings by by implementing
Icon
interface type
Now: Form subclass of
JComponent
public class MyComponent extends JComponent
{
public void paintComponent(Graphics g)
{
drawing instructions go here
}
...
}
Advantage: Inherit behavior from
JComponent
Example: Can attach mouse listener to
JComponent