Skip to content

Commit 28ec1be

Browse files
committed
Update Documentation for Paint Action
1 parent 9a4ceb5 commit 28ec1be

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

src/actions/PaintAction.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,47 @@
22

33
import ui.PaintPanel;
44

5+
/**
6+
* Paint Action abstracts a particular menu action
7+
*
8+
* Override this class to create a new Action.
9+
*
10+
* Perfrom action will only be called when can perform action returns true.
11+
*
12+
* Most of the cases, you have to call panel.repaint() as the last statement of
13+
* perform action
14+
*
15+
* @author chenzb
16+
*
17+
*/
518
public abstract class PaintAction {
6-
19+
720
protected PaintPanel panel;
821

9-
public PaintAction(PaintPanel panel){
22+
public PaintAction(PaintPanel panel) {
1023
this.panel = panel;
1124
}
12-
25+
26+
/**
27+
* Whether this action can perform. Subclasses generally base the return
28+
* value on the current selection on screen
29+
* <code>panel.getSelectTool().getSelectedComponents</code>
30+
*
31+
* @return true if the action can be performed
32+
*/
1333
public abstract boolean canPerformAction();
34+
1435
/**
15-
* Performs this action
16-
* Subclassess must invoke panel.repaint if the action changes the panel
36+
* Performs this action Subclassess must invoke panel.repaint if the action
37+
* changes the panel
1738
*/
1839
public abstract void performAction();
1940

41+
/**
42+
* The location of this item in the menu bar.
43+
* For example, "File/Save As..", "File/Open Recent/Clear Menu"
44+
* @return
45+
*/
2046
public abstract String locationString();
2147

2248
}

0 commit comments

Comments
 (0)