public class PastHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private FixedStack<javafx.scene.image.Image> |
future
The stack containing future images for redo
|
private static int |
NUM_STEPS
The number of steps forward/backward which will be saved
|
private Paint |
paint
The main class of the program
|
private FixedStack<javafx.scene.image.Image> |
past
The stack containing past images for undo
|
Constructor and Description |
---|
PastHandler(Paint paint)
Create a PastHandler
|
Modifier and Type | Method and Description |
---|---|
void |
addImage(javafx.scene.image.Image image)
Adds a new image to the past
|
boolean |
canRedo()
Checks whether a redo can be performed
|
boolean |
canUndo()
Checks whether an undo can be performed
|
boolean |
hasBeenChanged()
Returns whether the current image has been changed
|
javafx.scene.image.Image |
redo()
Get the image after redoing
|
void |
reset(javafx.scene.image.Image image)
Reset the past handler, such as when a new image is loaded
|
javafx.scene.image.Image |
undo()
Gets the image after undoing
|
private void |
updateButtons()
Update the state of the undo and redo buttons
|
private Paint paint
private static final int NUM_STEPS
private FixedStack<javafx.scene.image.Image> past
private FixedStack<javafx.scene.image.Image> future
public PastHandler(Paint paint)
paint
- the main class of the programpublic void addImage(javafx.scene.image.Image image)
image
- the new imagepublic javafx.scene.image.Image undo()
public boolean canUndo()
public javafx.scene.image.Image redo()
public boolean canRedo()
public void reset(javafx.scene.image.Image image)
image
- the starting imageprivate void updateButtons()
public boolean hasBeenChanged()