Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package drawer;
- import command.*;
- import java.util.*;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- public class DrawCanvas extends Canvas implements Drawable {
- private Color color = Color.ORANGE;
- private int radius = 20;
- private MacroCommand history;
- public DrawCanvas(int width, int height, MacroCommand history) {
- setSize(width, height);
- setBackground(Color.white);
- this.history = history;
- }
- public void paint(Graphics g) {
- history.execute();
- }
- public void draw(int x, int y) {
- Graphics g = getGraphics();
- g.setColor(color);
- g.fillOval(x - radius, y - radius, radius * 2, radius * 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement