展开全部
//画笔
import java.awt.*;
import java.util.*;
/**
* @author Hardneedl
*/
public interface Brush extends Observer{
void paint(java.awt.Graphics g);
Component getParent();
}
//画布
import javax.swing.*;
import java.awt.*;
/**
* @author Hardneedl
*/
public class BrushCanvas extends JComponent{
protected Brush brush;
public void setBrush(Brush brush) {
this.brush = brush;
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (brush!=null)
brush.paint(g);
}
}
//阿基米德62616964757a686964616fe4b893e5b19e31333337386630螺线的画笔实现
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
/**
* @auth