Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Här har vi ett interface som är lokalt
- // för denna klass. Lite exotiskt kanske...
- interface Draw
- {
- public void draw(Graphics g);
- }
- class GoLeftPainter implements Draw
- {
- public void draw(Graphics g)
- {
- g.drawImage
- (
- icon.getImage(),
- // Destination coordinates:
- rect.x + rect.width,
- rect.y,
- rect.x,
- rect.y + rect.height,
- // Source coordinates:
- 0,
- 0,
- rect.width,
- rect.height,
- null
- );
- }
- }
- class GoRightPainter implements Draw
- {
- public void draw(Graphics g)
- {
- g.drawImage
- (
- icon.getImage(),
- // Destination coordinates:
- rect.x,
- rect.y,
- rect.x + rect.width,
- rect.y + rect.height,
- // Source coordinates:
- 0,
- 0,
- rect.width,
- rect.height,
- null
- );
- }
- }
Add Comment
Please, Sign In to add comment