Can I have undo-redo based in words, not in characters?

I need to change the undoManager behavior, so that avery character insertion/deletion is taken as a UndoableEditEvent. I want to undo/redo based on words, or even in whole lines, not in single character insertion/deletion.
I've been researching a lot but nothing... any help is welcome.

Something like this may be what you are looking for:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=637225

Similar Messages

  • Can I have separate pages (using Microsoft word for mac 2011) utilizing a new iMac and a second monitor?

    Hardware - new iMac 21.7, Software Mirosoft word for Mac 2011.
    I presently adjust the text to allow two pages on my iMac monitor.
    If I add a second monitor can I have two different pages on it so I can
    see four consecutive pages (e.g. pages 31 and 32 on the iMac and pages
    33 and 34 on the second monitor)?  I am sure I can move items like
    pictures from one monitor to the other, but will the word processing
    software indicated above work like I would like it to?

    why would one of the pages be split?
    Because you'd stretch the Word window across both displays and the screen bezels would be larger than the page split. The page spacer in Word is much smaller than any bezel I've seen, so the two bezels would cause it to break up a page somewhere.

  • Can I have pages automatically replace specific words with the same word in a different font as I type?

    In MS Word I was able to set it up so any time I typed the name of the organization I run, Camp Aldersgate, it would automatically change the font to our branded font from our logo.  The font appears in the font list, and I can select it and use it.  How do I do the same thing in Pages?

    You can create a character style with the specific font. Custom styles are only document specific so save a documnet as a tempalte containing this style. Use this template when you need this style.
    When you have written you document use Find and replace > Advanced > write the word to find and write it again in the replace field but change the Style button option to the new specific style > press replace

  • How can I have a shortcut key that is not a JMenuItem

    Hi,
    I'm trying to make "ctrl-f" a shortcut key in my program.
    I know I can do this as a JMenuItem by:
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_MASK));
    However, I would rather not have it in the menu.
    How would I do this without having it as a JMenuItem?
    Thanks,
    Daniel Lorimer

    As a user I hate designs like this. How am I supposed to know what all the shortcut keys are? Using a menu item is a form of self documentation
    Anyway, check out the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Key Bindings.

  • Can I have auto adjust for RAW, but not for JPEG?

    I want auto adjust for RAW files, but NOT for JPEGs. I generate JPEGs from my adjusted RAWs and the last thing I want Bridge/ACR to do is to auto-adjust the generated JPEGs just because I looked at them in Bridge. Yet, I've been using auto-adjust on my RAW files for years and find it a useful starting point.
    Is there any way to configure ACR 4 to do auto-adjust on RAW files, but not on JPEG files?

    Anyone have any advice on this question? I like auto-adjust on RAW files. I like the idea of using ACR capabilities on some JPEGs, but letting ACR do auto-adjust on JPEGs that I generated from hand-tweaked RAW files just ruins the JPEGs completely. Thus, I'd like auto-adjust on RAWs, but not on JPEGs. Is there any way to do this?

  • Word not recognizing characters after upgrade

    Hi,
    After upgrading from Word for Mac 2004-11.6.6- to Word for Mac 2011-14.4.5 I am unable to open some of my files. I get a message the the document might cobtain invalid characters. The invalid character is /. I used it in the title to seperate dates as to when the file was sent, such as 7/04/14, 10/5/14.
    I have to drag the file to the old version of Word that thankfully I did not uninstall or I have to manually change the / to a - and then it works fine with the newer version.
    I recently went to update to OSX Yosemite and it informed me that the old version of Word would no longer run if I continued. I stopped the update.
    My questions are these:
    Must I manually change all of the titles first while the old version of Word is still running or can I upgrade the OS and change the files titles as I go later? There are 300-400 of them, some of which I need to keep but may not ever use again.
    Is the incompatability just in the titles or if I used a / or \ in the body will it reject those also? If so I will not be able to open them to correct it if I finish the OS upgrade.
    Also, I'm aware of the files in this folder that I'm currently speaking of but must I somehow search my computer for any archived Word files and change them also?
    Thanks in advance for your help.
    Joe

    Hi,
    After upgrading from Word for Mac 2004-11.6.6- to Word for Mac 2011-14.4.5 I am unable to open some of my files. I get a message the the document might cobtain invalid characters. The invalid character is /. I used it in the title to seperate dates as to when the file was sent, such as 7/04/14, 10/5/14.
    I have to drag the file to the old version of Word that thankfully I did not uninstall or I have to manually change the / to a - and then it works fine with the newer version.
    I recently went to update to OSX Yosemite and it informed me that the old version of Word would no longer run if I continued. I stopped the update.
    My questions are these:
    Must I manually change all of the titles first while the old version of Word is still running or can I upgrade the OS and change the files titles as I go later? There are 300-400 of them, some of which I need to keep but may not ever use again.
    Is the incompatability just in the titles or if I used a / or \ in the body will it reject those also? If so I will not be able to open them to correct it if I finish the OS upgrade.
    Also, I'm aware of the files in this folder that I'm currently speaking of but must I somehow search my computer for any archived Word files and change them also?
    Thanks in advance for your help.
    Joe

  • Keybindings for undo/redo buttons.

    I thought I knew how to do this, and I do seem to have this working fine for cut/copy/paste/select all keybindings CTRL X/C/V/A respectively.
    However I tried to do this for CTRL X and Y undo/redo and it's not working as I intended. Can anyone see what I'm doing wrong?
    I created a SSCCE based off the original example I was following from: [http://www.java2s.com/Code/Java/Swing-JFC/Undoredotextarea.htm]
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.KeyStroke;
    import javax.swing.event.UndoableEditEvent;
    import javax.swing.event.UndoableEditListener;
    import javax.swing.undo.CannotRedoException;
    import javax.swing.undo.UndoManager;
    public class UndoRedoTextArea extends JFrame implements KeyListener{
        private static final long serialVersionUID = 1L;
        protected JTextArea textArea = new JTextArea();
        protected UndoManager undoManager = new UndoManager();
        protected JButton undoButton = new JButton("Undo");
        protected JButton redoButton = new JButton("Redo");
        public UndoRedoTextArea() {
            super("Undo/Redo Demo");
            undoButton.setEnabled(false);
            redoButton.setEnabled(false);
            JPanel buttonPanel = new JPanel(new GridLayout());
            buttonPanel.add(undoButton);
            buttonPanel.add(redoButton);
            JScrollPane scroller = new JScrollPane(textArea);
            getContentPane().add(buttonPanel, BorderLayout.NORTH);
            getContentPane().add(scroller, BorderLayout.CENTER);
            textArea.getDocument().addUndoableEditListener(
                new UndoableEditListener() {
                    public void undoableEditHappened(UndoableEditEvent e) {
                        undoManager.addEdit(e.getEdit());
                        updateButtons();
            undoButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        undoManager.undo();
                    } catch (CannotRedoException cre) {
                        cre.printStackTrace();
                    updateButtons();
            undoButton.addKeyListener(this);
            redoButton.addKeyListener(this);
            redoButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        undoManager.redo();
                    } catch (CannotRedoException cre)  {
                        cre.printStackTrace();
                    updateButtons();
            setSize(400, 300);
            setVisible(true);
        public void updateButtons() {
            undoButton.setText(undoManager.getUndoPresentationName());
            redoButton.setText(undoManager.getRedoPresentationName());
            undoButton.setEnabled(undoManager.canUndo());
            redoButton.setEnabled(undoManager.canRedo());
        public static void main(String argv[]) {
            new UndoRedoTextArea();
        public void keyPressed(KeyEvent e){
            if (e.equals(KeyStroke.getKeyStroke
                (KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK))){
                // undo
                try {
                    undoManager.undo();
                } catch (CannotRedoException cre)  {
                    cre.printStackTrace();
                updateButtons();
            else if (e.equals(KeyStroke.getKeyStroke
                    (KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK))){
                // redo
                try  {
                    undoManager.redo();
                } catch (CannotRedoException cre) {
                    cre.printStackTrace();
                updateButtons();
        public void keyTyped(KeyEvent e){}
        public void keyReleased(KeyEvent e){}
    }Edited by: G-Unit on Oct 24, 2010 5:30 AM

    camickr wrote:
    So the way I posted in the second lump of code OK (3rd post) or did you mean something different? Why did you set the key bindings? Did I not state they would be created automatically? I think you need to reread my suggestion (and the tutorial).Because I don't get it, it says only Menu items can contain accelerators and buttons only get mnemonics. I'm not using menu items here, I only have a text pane and 2 buttons. So I set the actions for the InputMap in TextPane. For the buttons, I pretty much used the small bit of code using undoManager.
    I tried to set KEYSTROKE constructor for the action and simply add them to the buttons that way, but this didn't seem to have any response.
    Also I don't get how this could happen anyway if the TextPane has the focus.
    Not like the example using MNEMONICS.
        Action leftAction = new LeftAction(); //LeftAction code is shown later
        button = new JButton(leftAction)
        menuItem = new JMenuItem(leftAction);
    To create an Action object, you generally create a subclass of AbstractAction and then instantiate it. In your subclass, you must implement the actionPerformed method to react appropriately when the action event occurs. Here's an example of creating and instantiating an AbstractAction subclass:
        leftAction = new LeftAction("Go left", anIcon,
                     "This is the left button.",
                     new Integer(KeyEvent.VK_L));
        class LeftAction extends AbstractAction {
            public LeftAction(String text, ImageIcon icon,
                              String desc, Integer mnemonic) {
                super(text, icon);
                putValue(SHORT_DESCRIPTION, desc);
                putValue(MNEMONIC_KEY, mnemonic);
            public void actionPerformed(ActionEvent e) {
                displayResult("Action for first button/menu item", e);
        }This is what I attempted. No errors... It just doesn't work.
    public JPanel p()
        undoButton.addActionListener(new UndoAction(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK)));
        panel.add(undoButton);
        return panel;
    private class UndoAction extends AbstractAction
         public UndoAction(KeyStroke keyStroke)
              putValue(ACCELERATOR_KEY, keyStroke);
         private static final long serialVersionUID = 1L;
         public void actionPerformed(ActionEvent e)
              try
                   if (undoManager.canUndo())
                        undoManager.undo();
              catch (CannotRedoException cre)
                   cre.printStackTrace();
              updateButtons();
    }Edited by: G-Unit on Oct 25, 2010 8:32 AM

  • Problem with undo/redo actions in a StyledDocument

    Hello,
    In my app i have a text area where each user can keep some notes.The document is serialized and saved in the database for later access as StyledDocument, in order to be saved with the formating the user has chosen(for example with certain fonts,text color and size).
    What i want to do now is to give to the user the ability to undo/redo his actions. I have these methods implemented and everything worked fine when i was saving and loading simple text in my JTextPane (previously i was saving in the database what user typed as a simple string which meant that the formatting was lost). Now, after loading styled document (using the textPane.setStyledDocument(doc) code line) these actions do not work.
    Are there any suggestions on how i can make this work? Is it possible?
    I hope i made my problem clear enough
    Thanks in advance

    Seem like I found the answer to my issue: http://helpx.adobe.com/dreamweaver/using/whats-new-2014.html#Undo/Redo enhancements
    Undo/Redo enhancements
    All undo/redo actions are recorded at the HTML file-level. This means, any manual changes to a CSS file can be undone from ANY related file.
    Someone called it Undo/Redo enhancements!? Damn this is the most stupid thing one can imagine about undo/redo! How the heck editing one source file affects the other!? Do whatever you want in Designer mode, but I'm editing SOURCE CODE and need to be able to undo/redo my actions on a file level.
    With this change TextEdit or Notepad becomes a more suitable tool for editing HTML/CSS than Dreamweaver.

  • Can I have 2 Time Machines for 2 backups?

    I have an external hard drive that I use for my time machine. Recently I've been having some problems with my iMac that are hard drive related. I wasn't able to repair using disk utility and had to erase and reinstall Snow Leopard and then transfer everything back from time machine.
    After this I realize just how fragile this all is. I have many photos and videos of my family from years ago and was relieved that I had everything backed up. Hard drives are so inexpensive these days, I feel it may be wise to have another backup in the unlikely event both hard drives were to have problems at the same time.
    Can I have two Time Machines? If not, what are my options?
    Thanks for any suggestions on this topic.

    Yes, but not simultaneously. You can switch the desired backup drive using TM preferences, but TM cannot backup to two drives concurrently. However, I would suggest not using TM for your second backup. Instead consider making a bootable clone on the second drive. You can then use a third-party backup utility to incrementally update the clone. Because this software is running independently of TM you can have both a TM backup and a third-party backup. With TM backing up hourly you can set the second backup schedule to backup weekly and/or monthly.
    If something does go amiss with your main system drive, then you can boot from your clone in order to restore function to the main drive.
    To avoid using up space on the TM drive be sure you add your second backup drive to the TM Exclude list.
    Basic Backup
    Get an external Firewire or USB drive at least equal in size to the internal hard drive and make (and maintain) a bootable clone/backup. (Note: Most PPC Macs cannot be booted from a USB drive.) You can make a bootable clone using the Restore option of Disk Utility. You can also make and maintain clones with good backup software. My personal recommendations are (order is not significant):
    1. Retrospect Desktop (Commercial)
    2. Synchronize! Pro X (Commercial)
    3. Synk (Backup, Standard, or Pro)
    4. Deja Vu (Shareware)
    5. Carbon Copy Cloner (Donationware)
    6. SuperDuper! (Commercial)
    7. Intego Personal Backup (Commercial)
    8. Data Backup (Commercial)
    9. SilverKeeper 2.0 (Freeware)
    10. MimMac (Commercial)
    11. Tri-Backup (Commercial)
    Visit The XLab FAQs and read the FAQ on backup and restore. Also read How to Back Up and Restore Your Files.
    Although you can buy a complete FireWire drive system, you can also put one together if you are so inclined. It's relatively easy and only requires a Phillips head screwdriver (typically.) You can purchase hard drives separately. This gives you an opportunity to shop for the best prices on a hard drive of your choice. Reliable brands include Seagate, Hitachi, Western Digital, Toshiba, and Fujitsu. You can find reviews and benchmarks on many drives at Storage Review.
    Enclosures for FireWire and USB are readily available. You can find only FireWire enclosures, only USB enclosures, and enclosures that feature multiple ports. I would stress getting enclosures that use the Oxford chipsets (911, 921, 922, for example.) You can find enclosures at places such as;
    Cool Drives
    OWC
    WiebeTech
    Firewire Direct
    California Drives
    NewEgg
    All you need do is remove a case cover, mount the hard drive in the enclosure and connect the cables, then re-attach the case cover. Usually the only tool required is a small or medium Phillips screwdriver.

  • Can I have i cloud. On my iPad. Without it on my MacBookPro

    I am unable to get Snow Leopard on my MacBookPro and I want it on my IPad. The notebook is not working properly and I bought the IPad instead of a new computer. But now I need to be able to have my mail on my IPad since MobillMe is being discontinued.

    Can you have iCloud on the iPad while not on your laptop?  Yes.  Just login to mobileme.com and click the link to upgrade to iCloud.  Then on your iPad, go to settings, icloud and sign in.  Be sure to turn off mobile me in settings if there.  Then remove your mobile me email account and create a new icloud account using the same ID you have on mobile me (but after doing the upgrade).

  • How can I use undo and redo with run time menu?

    Hi..I try to built my own menu for graphic programming. How can I use undo and redo in labview with run time menu?

    filozof-
    During runtime, by default, LabVIEW has undo/redo data changes under the edit menu. This will undo/redo changes made to controls during runtime. If you want a more extensive undo/redo (custom for your application), you are going to have to do quite a few things
    1) Create a custom runtime menu (Edit>>RunTime Menu) and place your own undo/redo controls on it
    2) Keep an action history in your program
    3) Catch the Shortcut menu event for your custom undo/redo controls
    4) Reverse the last action in your histroy when you catch the event
    This method would allow you undo entire operations (like resize, move, or whatever kind of functionality you are building into your application) unstead of just undoing data changes.
    Xaq

  • I am using a code based typesetting program (not WYSISYG) that outputs PDFs. I am producing 100 plus pages that have multiple graphics on each page. I need to know how to format a PDF command that I can incllude in my programming that will tag my graphics

    I am using a code based typesetting program (not WYSISYG) that outputs PDFs. I am producing 100 plus pages that have multiple graphics on each page. I need to know how to format a PDF command that I can incllude in my programming that will tag my graphics with "Alternative Text".
    I know that with a Microsoft product graphics can be tagged before a PDF is made. I need to know how to do this with my programming.

    The Acrobat SDK might be a starting point.
    From there, perhaps a plug-in (built with C+).
    Perhaps with a licensed release of a PDF Library (this could be $$).
    The viable and cost effective alternative is use the tried and true.
    Authoring in an appropriate authoring application with appropriate tag management.
    Example:  Adobe InDesign; Adobe FrameMaker or MS Word with PDFMaker (comes with install of Acrobat).
    This way you place "Alternative Text" when mastering content in the authoring file.
    Going the route and with some look-see (research) you may find programmatic approaches to placing the alt txt in the authoring file.
    Note: as discussed in the Matterhorn Protocols there is no programmatic method that provides a fully accessible PDF (specifically, that is an ISO 14289-1, PDF/UA-1 compliant PDF).
    Regardless, here you have a sub-forum for discussions on Acrobat usage.
    Consequently discussions on/of 3rd party software is rather out of scope eh.
    Be well...

  • I have a document that in Word required a password to open. I copied and pasted it to Pages. Put the password protection on. Now if I click on that filename in Finder it automatically opens.Why. Anyone can read it. How do I protect it again?

    I have a document that in Word required a password to open. I copied and pasted it to Pages. Put the password protection on. Now if I click on that filename in Finder it automatically opens.Why. Anyone can read it. How do i protect it again?

    You saved it after setting the Password? :
    Inspector > Document > Document > Require Password to Open
    I just tested it and it shows up ijn The Finder with a padlock on the file icon and does require a password to open.
    Peter

  • In R12 can we have approval based on rules like Cost Cente or Account?

    Hi All,
    -In R12 GL can we have approval based on rules like Cost Centers or Account. I know a rule based on Amount can be setup
    -In R12 GL can we use the PO hierarchy and its Rules
    Thanks.

    Dear Srinivasan Muthu,
    Assuming that Red,Blue and white are the values for the chracteristic say Colour and if this assigned to
    a class type say 023 batch,while uploading the stock,the system asks the chracteristic value.
    Say suppose if you are entering 561in MB1C or 101 movement in MIGO for that material and if you
    select for Blue,then in MMBE you can click on the stock quantity and right click-->batch classification.
    The system shows for Blue colour.
    check and revert back.
    Regards
    Mangalraj.S

  • HT4085 So does this mean that I cannot have rotation lock off and the mute function off at the same time? In other words, can I have my screen rotate automatically as I hold my iPad in either portrait or landscape AND hear sounds from my apps at the same

    So does this mean that I cannot have rotation lock off and the mute function off at the same time? In other words, can I have my screen rotate automatically as I hold my iPad in either portrait or landscape AND hear sounds from my apps at the same time?

    In other words, can I have my screen rotate automatically as I hold my iPad in either portrait or landscape AND hear sounds from my apps at the same time?
    Yes, you can. You can configure the Side Switch (above the volume button) either as Mute switch or Rotation lock.
    Settings > General > Use Side Switch to: choose what you like the Side Switch to function as.

Maybe you are looking for

  • Unable to see shared library (still)

    I tried to continue an old thread that I had started on this topic but it has been archived - http://discussions.apple.com/message.jspa?messageID=9317333#9317333 Anyway, all I want to do is access my iTunes music from another computer on the network.

  • My backup is missing from the list?

    We use our Time Capsule for multiple Macs.  Recently my laptop started acting up, (which turned out to be a hard drive problem), but when I logged into the Time Machine to restore the backup to another Mac I don't see my laptop in the list of Backups

  • WF not working

    Hi expert, We set up a worklfow on SOD. However, it works on my colleagues' laptop not mine. The only possible explanation we can think of is the IE version. I am on IE7.O while my colleagues are on 6.0 or earlier version. I am not sure if this is th

  • M515 and Windows Vista 64 bit HotSync Issue

    Hi I have a M515 which I am unable to sync with a Windows Vista 64 bit machine using a USB cable. My computer does not have a IR port. Read thru several threads but did not find a solution for this problem for a 64 bit machine. Any help would be grea

  • After opening an excel doc with actve X, crashes when calling excel again

    i created an application that allows the user to read in an excel spreadsheet, chop it up, then stuff it into a database. it also can generate 2 reports as excel spreadsheets . when i run the reports alone it works fine but when i chop up the spreads