Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Eraser and Undo? #40

Open
duongxinh2003 opened this issue Apr 2, 2020 · 1 comment
Open

How to use Eraser and Undo? #40

duongxinh2003 opened this issue Apr 2, 2020 · 1 comment

Comments

@duongxinh2003
Copy link

Anyone can help me how to use eraser and undo path? Thanks!

@winthesky
Copy link

eraser like this:

    public JButton getEraserButton() {
        if (eraserButton == null) {
            eraserButton = new JButton("eraser");
            eraserButton.addActionListener(e -> {
                deactivateTool();
                activeTool = PaintToolBuilder.create(PaintToolType.ERASER)
                        .makeActiveOnCanvas(getImageCanvas())
                        .withStroke(StrokeBuilder.withShape().ofRectangle(20, 20).build())
                        .build();
            });
        }
        return eraserButton;
    }

undo like this:
canvas.undo();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants