Package com.lightcrafts.ui.region

Examples of com.lightcrafts.ui.region.RegionOverlay


        r.setEnabled(undo.canRedo());
    }

    public static void main(final String[] args) throws Exception {
        EventQueue.invokeLater(new Runnable() { public void run() {
            final RegionOverlay overlay = new RegionOverlay();
            overlay.setCookie(new Object(), false, true);
            Dimension size = new Dimension(400, 400);
            overlay.setPreferredSize(size);

//            // Useful for making icons out of screenshots:
//            overlay.setTransform(AffineTransform.getScaleInstance(4, 4));

            undo = new UndoManager() {
                public boolean addEdit(UndoableEdit edit) {
                    boolean result = super.addEdit(edit);
                    updateButtons();
                    return result;
                }
            };
            overlay.addUndoableEditListener(undo);

            u = new JButton("Undo");
            u.addActionListener(
                new ActionListener() {
                    public void actionPerformed(ActionEvent event) {
                        if (undo.canUndo()) {
                            undo.undo();
                            overlay.repaint();
                        }
                        updateButtons();
                    }
                }
            );

            r = new JButton("Redo");
            r.addActionListener(
                new ActionListener() {
                    public void actionPerformed(ActionEvent event) {
                        if (undo.canRedo()) {
                            undo.redo();
                            overlay.repaint();
                        }
                        updateButtons();
                    }
                }
            );
View Full Code Here

TOP

Related Classes of com.lightcrafts.ui.region.RegionOverlay

Copyright © 2018 www.massapicom. 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.