I have created a Paint application using Controller, Composite(Shapes) and Command(undo/redo) pattern. Now I wanted to modify it and reduce the complexity using state pattern. I know states will be Box/circle/line... transition will be methods to change from 1 state to another.
Snippet of my code:
public void canvasClicked(int x, int y, Graphics g) {
switch(this.Click_Button) {
case Box:
add()
break;
case Circle:
default:
add()
break;
}
this.component.draw();
}
What I am confused is where to start with and how to do it. Do I have to remove the composite pattern and do or is it that I am missing something here?
Any references for drawing tool examples will be appreciated as well.
Thank you
Aucun commentaire:
Enregistrer un commentaire