Can Undo & Redo text writing functions be set as icons?

Undo & Redo are available as CTRL functions or from a menu but how do I set them up with an icon along with the other text editor icons?

The Redo and Undo buttons are available with Toolbar Buttons, as part of the full add-on, or just those buttons.
https://codefisher.org/toolbar_button/toolbar_button_maker/
http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html
Right-click a Write window toolbar, Customize, and drag the buttons onto the toolbar.

Similar Messages

  • HOW can I enter text using Japanese character sets?

    The "Text, Plates, Insets" section of the LOOKOUT(6.01) Help files states:
    "Click the » button to the right of the Text field to expand the field for multiple line entries. You can enter text using international character sets such as Chinese, Korean, and Japanese."
    Can someone please explain HOW to do this? Note, I have NO problem inputting Hirigana, Katakana, and Kanji into MS WORD; the keyboard emulates the Japanese layout and characters (Romaji is default) and the IME works fine converting Romaji, and I can also select charcters directly from the IME Pad. I have tried several different fonts with success and am currently using MS UI Gothic.ttf as default. Again, everything is normal and working in a predictable manner within Word.
    I cannot get these texts into Lookout. I can't cut/paste from HTML pages or from text editors, even though both display properly. Within Lookout with JP selected as language/keyboard, when trying to type directly into the text field, the IME CORRECTLY displays Hirigana until <enter> is pressed, at which point all text reverts to question marks (?? ???? ? ?????). If I use the IME Pad, it does pretty much the same. I managed to get the "Yen" symbol to display, though, if that's relevant. As I said, font selected (in text/plate font options) is MS UI Gothic with Japanese as the selected script. Oddly enough, at this point the "sample" window is showing me the exact Hirigana character I want displayed in Lookout, but it won't. I've also tried staying in English and copying unicode characters from the Windows Character Map. Same results (Yen sign works, Hirigana WON'T).
    Help me!
    JW_Tech

    JW_Tech,
    Have you changed the regional setting to Japanese?
    Doug M
    Applications Engineer
    National Instruments
    For those unfamiliar with NBC's The Office, my icon is NOT a picture of me
    Attachments:
    language.JPG ‏50 KB

  • How do I retain Jbutton text for action event & set img icon on Jbutton

    I need to retain the text on my button as I use this to identify the action event in actionPerformed method when the button is pressed.
    Hoe do I add an image icon to the Jbutton without effecting this?
    [/b]
    class CalcPanel extends JPanel
        implements ActionListener, CurrencyVals
    //currency panel data members
        JButton[] cb = new JButton[4];
    JPanel cbkeys = new JPanel(new GridLayout(4,1));
    //Toolkit tk = Toolkit.getDefaultToolkit();
        //Image img = tk.getImage("D:/temp/ausflag.jpg");
    public CalcPanel(){
    ImageIcon b = new ImageIcon("D:/temp/ausflag.jpg","AUS");
        cb[AUS]= new JButton(b);  //cb[AUS]= new JButton("AUS");
          cbkeys.add(cb[AUS]);
          cb[AUS].addActionListener(this);
    setLayout(new BorderLayout());
        add(display, BorderLayout.NORTH);
        add(keys, BorderLayout.CENTER);
        add(cbkeys, BorderLayout.EAST);
        add(label, BorderLayout.SOUTH);
        public void actionPerformed(ActionEvent evt){
          Object source = evt.getSource();
          int id;
          if (keyBoard) {
            if (source instanceof JButton) {
              String s = ((JButton)source).getText();
    [/b]Regards
    Synfield

    if(keyBoard) { ??! [/b]... do have cause to feel flattered?
    Copy and paste this and save a small eg;- 25px high x 50px wide Jpeg image in the same file and call it "new.jpg", then study it, this posted program (again?) to see where your code went astray.
    THEN, figure out what you want to do with your code ...keep at it!
    Sue x
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ButtonIcon extends JFrame implements ActionListener {
    String []str ={"abc","def","ghi","jkl","mno","pqr","st","uvw"};
    JButton b[] = new JButton[str.length];
       JButton on = new JButton("ON");
       JButton off = new JButton("OFF");
       JButton picture;
       JPanel panel;
       String str2="";
       Font font = new Font("Comic Sans MS" ,0, 14);
       boolean keyBoard;
       ImageIcon icon = new ImageIcon("new.jpg");
    public ButtonIcon(){
       Container c = getContentPane();
       panel = new JPanel();
       panel.setLayout(new FlowLayout());
       picture = new JButton(icon);
       for (int j=0; j<=str.length-1; j++){
             b[j]= new JButton(str[j]);
             b[j].setFont(font);
             panel.add(b[j]);
             b[j].addActionListener(this);
       on.addActionListener(this);
       off.addActionListener(this);
       panel.add(on);
       panel.add(off);
       panel.add(picture);
       c.add(panel);
       public void paint (Graphics g) {
          super.paint (g);
          Graphics2D G = (Graphics2D) g;
          G.setColor(Color.red);
          G.setFont(font);
          G.drawString(str2, 25, 150);
    public void actionPerformed(ActionEvent evt){
        String command = evt.getActionCommand();
        if (keyBoard) {
           if (evt.getSource() instanceof JButton ) {
               str2 += command;
           if (evt.getActionCommand().equals("OFF")) str2 = "";
        if(command.equals("ON")) keyBoard = true;
        if(command.equals("OFF")) keyBoard = false;
    repaint();
    public static void main (String []args){
       ButtonIcon boo = new ButtonIcon();
       boo.setSize(300,200);
       boo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
       boo.setVisible(true);

  • Undo/Redo help please...

    I want to include undo/redo capabilities in my app. All the examples and code that I've seen deals with text. Can undo/redo handle undoing the move of an object(from one side of screen to the other), undoing the adding of a label or panel to a frame, etc..? If so could someone point me in the right direction or post some sample code.
    thanks...

    how do i redraw the contents of a panel again. I don't know about the internals of your program. I just described a general approach to undo levels.
    If you're adding labels to a panel, then you're trying to undo the GUI itself? What, are you trying to make some kind of rapid prototyping tool for java GUIs? If so, the problem I see here is that you may have to re-compile and re-run the app being designed every time you make a change.
    Or is "label" relevant only to your app with nothing to do with java labels?
    this panel is inside an internalframe ...
    redraw only that panel without redrawing other parts of the window. AWT handles this fine. Swing probably does as well though I don't know.
    but if i move the cursor to the controls in the applet whole
    labels which i moved in the panel comes to their
    original position. how do i fix this.This depends on how you implemented it. There's no way someone reading this forum can see what your problem is from this description and give you a repair. Maybe someone who has worked on similar projects can hazard a reasonable guess.

  • User defined function to set a default value of a column

    Hi All
    Can we use user defined function to set a default value of a column ??
    for example:
    create or replace  function test1  return number is
    begin
    return 10;
    end;
    create table testt
    (id  as test1,
      name varchar2(20));
    error:
    ORA-02000: missing ( keywordThanks
    Ashwani

    174313 wrote:
    MichaelS for showing example to use function in table ddl , otherwise i was thinking we cannot use function in table ddl as per error I received.That was an example of a virtual column.
    ORA-04044: procedure, function, package, or type is not allowed hereUsing PL/SQL code like that raises 2 basic problems. If that PL/SQL code for the calculating the column default breaks, what happens to the SQL insert statements against that table. These will need to fail as the table definition depends on the PL/SQL code. This is problematic as this dependency simply increases the complexity of the SQL object.
    The 2nd issue is performance. PL/SQL code needs to be executed by the PL/SQL engine. This means a context switch from the SQL engine to the PL/SQL engine in order to determine the default value for that column. Context switching is a performance overhead.
    So even if it was possible to use a PL/SQL function as parameter for the SQL default clause, I would not be that keen to use it.

  • Setting Undo/Redo menu text

    When artwork is changed, the text for the Undo menu will be something like "Undo Move" or "Undo Color".  The AIUndo suite has a SetUndoText function that "Specifies the localizable text for Undo and Redo menu items".  However, when I use this function for my plugin, the text doesn't come out the way I would think.  When I pass in "Create" for the undo text, the menu will show up as "CreateUndo".  Ok, I can fix the spacing issue...  But it seems I should be able to set the entire string, not just half of it.  Or at least, the text I pass in should show up after 'Undo', not before it, to make it look like a normal Undo action.
    Am I missing something, or does this just not work correctly?

    It's not pretty, but here's the dump:
    #ifdef WIN_ENV
    #define CAPITAL_A_ANGSTROM        "\xC5"
    #define SMALL_A_ANGSTROM        "\xE5"
    #define A_ACCENT_UMLAUT            "\xE4"
    #define E_ACCENT_AIGU            "\xE9"
    #define O_ACCENT_AIGU            "\xF3"
    #define O_ACCENT_UMLAUT            "\xF6"
    #define U_ACCENT_UMLAUT            "\xFC"
    #define NORWEIGIAN_O            "\xF8"
    #define SMALL_LATIN_LIGATURE    "\xE6"
    #define GERMAN_BETA                "\xDF"
    #else
    #define CAPITAL_A_ANGSTROM        "\x81"
    #define SMALL_A_ANGSTROM        "\x8c"
    #define A_ACCENT_UMLAUT            "\x8A"
    #define E_ACCENT_AIGU            "\x8E"
    #define O_ACCENT_AIGU            "\x97"
    #define O_ACCENT_UMLAUT            "\x9A"
    #define U_ACCENT_UMLAUT            "\x9F"
    #define NORWEIGIAN_O            "\xBF"
    #define SMALL_LATIN_LIGATURE    "\xBE"
    #define GERMAN_BETA                "\xA7"
    #endif
    const char* UNDO_TEXT_TYPE_LOOKUP_TABLE[11][2] = {
            // English
            { "Undo", "Redo" },
            // Danish
            { "Fortryd", "Gentag" },
            // French
            { "Annuler", "R" E_ACCENT_AIGU "tablir" },
            // German
            { "R" U_ACCENT_UMLAUT "ckg" A_ACCENT_UMLAUT "ngig:", "Wiederherstellen:" },
            // Spanish
            { "Deshacer", "Rehacer" },
            // Finnish
            { "Peru", "Tee sittenkin" },
            // Italian
            { "Annulla", "Ripristina" },
            // Dutch
            { "Ongedaan maken", "Opnieuw" },
            // Norwegian
            { "Angre", "Gj" NORWEIGIAN_O "r om " },
            // Brazilian Portuguese
            { "Desfazer", "Refazer" },
            // Swedish
            { CAPITAL_A_ANGSTROM "ngra", "G" O_ACCENT_UMLAUT "r om" }

  • Undo Redo Function

    Hi all,
    I want to implement Undo Redo functionality in my application.For example , I have a JFrame with a button in it. On clicking the button i am importing a image in to it,and performing some action like resizing the image and dragging it within the frame.What if i want to go back in the process.I have no idea about it.Please help me do that.
    Thanks in advance
    Ravisenan

    This is far from being easy...
    Basically, you have to put every action on a stack, where you can recall them. Each action must contain ALL Information that has been changed, before it was changed. So when you undo it, you copy back all necessary properties.
    Based on the complexity and design of your program, this can be one hell of a problem. I wish you good luck.

  • I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I have powerpoint for Mac on my imac.  I can't seem to get the active text box function to work like it did on my PC.  How can I insert an active textbox into a presentation that will allow me to type while presenting?

    I've gotten a little further on this. The dynamic select is
    working fine. It's the "a href" code that isn't. I'm wondering if
    someone can look at this line and tell me if it's okay to build the
    query string this way. The storeid comes through fine but I'm still
    not getting the employeeid value to pass. Here's line that's not
    working:
    td><a href="registerStoreCust.php?storeid=<?php echo
    $row_storeRS['storeid']; echo "&employeeid="; echo
    $_GET['employeeLM']; ?>">Register
    Customer</a></td>

  • Import function is blocked. Can this be changed with a security setting?

    I want to import bookmarks that I saved from old computer. When I go to File in the menu bar, the import is blocked (shaded white). How can I activate the import function?

    Do you have an HTML or JSON backup from that old computer?
    See:
    * http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox
    Make sure that the backup file with the bookmarks has the correct file extension: .html for a HTML backup and .json for a JSON backup.<br />
    You can check that via the right-click context menu of that file and open the Properties.<br />
    If you are not sure about the file type then you can open the file in Firefox via "File > Open File"<br />
    A JSON backup will show as one long text line without line breaks and a HTML backup as a web page with clickable links.
    A JSON backup starts with: <nowiki>{"title":"","id":1,"dateAdded":</nowiki>
    An HTML backup starts with: <nowiki><!DOCTYPE NETSCAPE-Bookmark-file-1></nowiki>
    You may need to add quotes ("bookmarks.xxxx") around the name to rename the file to the correct file extension.

  • 2013 Honda Civic Si, SMS Text Message Function says "Unsupported Device" when trying to use this feature with iPhone 5. Can anyone help with this?

    In my 2013 Honda Civic Si, I'm trying to use the SMS Text Message Function, but keep getting the error message, "Unsupported Device".
    I use an iPhone 5 with latest iOS 6.1.4.
    HandsFreeLink works perfectly fine with my iPhone for voice calls and for streaming Bluetooth Audio. Does text messaging not work because of iMessage? Does anyone have any suggestions for this issue?
    Thanks in advance!

    In looking for a 2013 Honda Civic (LX model, no Navi), the text feature was very interesting and important to me. Why not have my texts available on the dash and read to me rather than messing with my phone. Anyway I won't go into the whole thing about safety while you're in your driving and all that. We all know what we should and shouldn't do. Anyways...
    I spoke to a salesman who said that this feature was not compatible with the iPhone, only BBs. Of course this didn't impress me and I found it hard to believe that Honda would restrict themselves like that. Anyway, a few searches on the web later and Honda shows that the iPhone 4, 4S and 5 are compatible for receiving texts through the car, just not sending them. I believe you need a minimum of iOS 5+ for it to work though.
    Once I found this the salesman and I did some testing with our phones. He has a 4S with iOS 6.1.3 and mine is a 4 with iOS 6.1.3. Initially we setup the phone using the Bluetooth config on the Civic's iMID display. It was setup and hands-free calling tested o.k. Next the texting was tested. Both of us have iMessage turned on. Neither of us could get the messages we would send each other (1 of us had our phone setup with the car, the other sent the text and vice versa). The messages were received by the phones, just not the car). When we would go under the Text Message section, it would say "Unsupported Device". I knew that couldn't be as Honda said it was compatible. After more web searches and a phone call to Honda by the salesman, I found the following.
    1) It seems like the person who had their phone paired with the Civic had to disable iMessage to start getting texts. The salesman still had it enabled on his though when he sent me texts (as SMS) and the Civic got them so both people aren't necessarily required to disable it. Now under the Text Message section, it would list the messages received.
    2) I changed the Notifications on my phone for Messages from Banner to Alerts. Once I did this it started to work. The texts were showing up on the car. I had read where another person had tried this successfully but then changed it back to Banner and it continued to work. I experienced the same thing.
    Granted this wasn't extensive testing but I was able to get it to do something closer to what I wanted. I'm not sure why Apple and Honda can't put their heads together to make sending texts work on the car but maybe someday it will work when enough people complain. It's kind of a disappointment that I couldn't get iMessage to work but I haven't given up hope yet. As it's a proprietary protocol, I can see Honda not supporting it though.
    Hope this helps someone out!
    FYI I bought car!

  • All my recent downloaded programs are in Chinese. Is there a setting in Firefox that I can undo this problem? I'm using English GB.

    All my recent downloaded programs are in Chinese. Is there any ways I can undo this problem? I using Firefox English GB.
    == This happened ==
    A few times a week
    == A month ago

    Hi B.
    First of all, and although possibly not related to your problem, I will remind you that the version of Firefox you are using at the moment as been discontinued and is no longer supported. Furthermore, it has known bugs and security problems. I urge you to update to the latest version of Firefox, for maximum stability, performance, security and usability. You can get it for free, as always, at [http://www.getfirefox.com www.getfirefox.com].
    As for your problem, you may be having a problem with some extension or plugin that is hindering your Firefox's normal behavior. Have you tried disabling all add-ons (just to check), to see if Firefox goes back to normal?

  • 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

  • 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

  • Undo/Redo in JTextArea using UndoableEditListener

    I tried to implement undo/redo functionality in JTextArea using UndoableEditListener
    interface, but it throws java.lang.NullPointerException. I really not sure
    how the UndoableEditListener works?? I mean when the user type text in JTextArea,
    it already listens the event?? But when I go to menu bar and select "undo item,"
    how can they communicate??
    Here's my attempts. Thanks a lot!!
    private UndoManager undoManager;
    UndoableEditSupport edit = new UndoableEditSupport();
    //Registers an UndoableEditListener.
    edit.addUndoableEditListener(this);
    public void undoableEditHappened(UndoableEditEvent evt)
    {     undoManager = (UndoManager)evt.getEdit();
         //AbstractUndoableEdit edit = evt.getEdit();
    if (undoManager.canRedo())
         System.out.println("can redo...");
    if (undoManager.canUndo())
         System.out.println("can undo...");
    public void actionPerformed(ActionEvent evt)
    Object source = evt.getSource();
         if (source == undoItem)
              String s = undoManager.getUndoPresentationName();
              System.out.println("undo item = " + s);
    }

    Hi
    Sinceraly never used it in JTextArea components but since it also is an JTextComponent (as is JTextField) try to use this method:
        * add UNDO&REDO commands to a given textfield
      private void addUndoRedo(JTextField tf) {
        final UndoManager undo = new UndoManager();
        Document doc = tf.getDocument();
        doc.addUndoableEditListener(
          new UndoableEditListener() {
            public void undoableEditHappened(UndoableEditEvent evt) {
              undo.addEdit(evt.getEdit());
        tf.getActionMap().put(EDIT_CONTROLS[6][0], // UNDO
          new AbstractAction(EDIT_CONTROLS[6][0]) {
            public void actionPerformed(ActionEvent evt) {
              try {
                if (undo.canUndo()) { undo.undo(); }
              } catch (CannotUndoException e) {}
        tf.getInputMap().put(KeyStroke.getKeyStroke(EDIT_CONTROLS[6][1]), EDIT_CONTROLS[6][0]);
        tf.getActionMap().put(EDIT_CONTROLS[7][0], // REDO
          new AbstractAction(EDIT_CONTROLS[7][0]) {
            public void actionPerformed(ActionEvent evt) {
              try {
                if (undo.canRedo()) { undo.redo(); }
              } catch (CannotRedoException e) {}
        tf.getInputMap().put(KeyStroke.getKeyStroke(EDIT_CONTROLS[7][1]), EDIT_CONTROLS[7][0]);
      }I believe it'll work fine, please reply as possible.
    Regards.

  • New to undo/redo on component

    hello all,
    i'm new to swing programming & i have to develop a web enabled application. in that i'm having an internalframe which contains a panel with some labels in it. i'm able to move the labels around the panel by using mouse listener. but my problem is i have to implement undo/redo functionality on this movement. but i don't know how to proceed since i don't have a single idea abt this api. i got some materials related to undo/redo of textual components. but nothing related to this labels or components like that. can someone help me on this topic or guide me to some links which has details. if u can provide me some code samples i'll be really greateful.
    Thanks in advance

    The Java Tutorial provides a section on how to implement the java.swing.undo package.
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#undo
    The TextComponentDemo example code it references uses a text Document to generate the UndoableEditListener events, but any component document or data model can be coded to do the same thing, such as the data model for your label placement panel. The listeners are usually added by a controlling parent class, such as a JFrame.
    * Create an addUndoableEditListener(UndoableEditListener listener) method in your model class.
    * Whenever an undoable edit is done in your model class, create an UndoableEditEvent object with the undoable edit data and call the undoableEditHappened(UndoableEditEvent e) method for all of your registered listeners.
    * Create an UndoManager object in your controlling parent class.
    * Create UndoAction and RedoAction subclassed objects in your controlling parent class.
    * Create an UndoableEditListener object in your controlling parent class and add it to your model class.
    The listeners will handle adding the UndoableEditEvent object to the UndoManager and updating any menu or toolbar Undo/Redo actions. The Undo/Redo actions will handle performing the commands via the UndoManager and updating the state of the Undo/Redo actions.
    I hope you find this of some help.

Maybe you are looking for