Package javax.swing.undo

Examples of javax.swing.undo.UndoableEdit.undo()


        ue.undo();
        Position pos = content.createPosition(5);
        assertEquals(5, pos.getOffset());
        ue.redo();
        assertEquals(3, pos.getOffset());
        ue.undo();
        assertEquals(5, pos.getOffset());
    }

    public void testCreatePositionAfterInsert() throws BadLocationException {
        UndoableEdit ue = content.insertString(10, "big ");
View Full Code Here


    public void testCreatePositionAfterInsert() throws BadLocationException {
        UndoableEdit ue = content.insertString(10, "big ");
        Position pos = content.createPosition(12);
        assertEquals(12, pos.getOffset());
        ue.undo();
        assertEquals(10, pos.getOffset());
        ue.redo();
        assertEquals(12, pos.getOffset());
    }
View Full Code Here

        int[] offsets = new int[v.size()];
        for (int i = 0; i < pos.size(); i++) {
            offsets[i] = pos.get(i).getOffset();
        }
        UndoableEdit ue = content.remove(0, 9);
        ue.undo();
        for (int i = 0; i < pos.size(); i++) {
            assertEquals(offsets[i], pos.get(i).getOffset());
        }
    }
View Full Code Here

        // This call causes all the garbage collected positions to be
        // removed from the internal list
        UndoableEdit ue = content.remove(0, 5);
        assertEquals("5678", content.getString(0, content.length() - 1));
        // Test (it shouldn't fail with any NullPointerException)
        ue.undo();
        assertEquals("012345678", content.getString(0, content.length() - 1));
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.