jmonet icon indicating copy to clipboard operation
jmonet copied to clipboard

How to use Eraser and Undo?

Open duongxinh2003 opened this issue 4 years ago • 1 comments

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

duongxinh2003 avatar Apr 02 '20 09:04 duongxinh2003

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();

winthesky avatar Dec 14 '20 06:12 winthesky