Example usage for javax.swing.undo StateEdit end

List of usage examples for javax.swing.undo StateEdit end

Introduction

In this page you can find the example usage for javax.swing.undo StateEdit end.

Prototype

public void end() 

Source Link

Document

Gets the post-edit state of the StateEditable object and ends the edit.

Usage

From source file:UndoableDrawingPanel.java

public UndoableDrawingPanel() {
    MouseListener mouseListener = new MouseAdapter() {
        public void mouseReleased(MouseEvent mouseEvent) {
            StateEdit stateEdit = new StateEdit(UndoableDrawingPanel.this);
            polygon.addPoint(mouseEvent.getX(), mouseEvent.getY());
            stateEdit.end();
            undoableEditSupport.postEdit(stateEdit);
            repaint();//  w  w w .  j av a  2 s .  c  om
        }
    };
    addMouseListener(mouseListener);
}

From source file:UndoableDrawingPanel2.java

public UndoableDrawingPanel2() {
    MouseListener mouseListener = new MouseAdapter() {
        public void mouseReleased(MouseEvent mouseEvent) {
            StateEdit stateEdit = new StateEdit(UndoableDrawingPanel2.this);
            polygon.addPoint(mouseEvent.getX(), mouseEvent.getY());
            stateEdit.end();
            undoableEditSupport.postEdit(stateEdit);
            repaint();/*w w  w.ja  v  a2 s.c  o m*/
        }
    };
    addMouseListener(mouseListener);
}