Undo

Discussion in 'Java' started by freesoft_2000, Feb 13, 2005.

  1. Hi everyone,

    I am trying to add an undo listener to a jtable but could
    not get it to work. Does anyone know how to add a undo function to a jtable
    assuming the default cell editor component is a jtextfield?

    A small code sample would be helpful

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West
     
    freesoft_2000, Feb 13, 2005
    #1
    1. Advertising

  2. freesoft_2000

    Oscar kind Guest

    freesoft_2000 <> wrote:
    > I am trying to add an undo listener to a jtable but could
    > not get it to work. Does anyone know how to add a undo function to a jtable
    > assuming the default cell editor component is a jtextfield?


    AFAIK, JTable, JTextField and the other Swing components do not support
    undo by themselves. This means that you'll need to keep a stack of past
    values, and reinsert those values when a specific action is triggered.

    Thus you need:
    - A (limited) stack of past values or changes
    - A ChangeListener that pushes records on this stack for all changes
    - An ActionListener that pops records from the stack and undoes changes

    The ChangeListener is tied to all components that may be undone; the
    ActionListener is tied to the undo button (or menu item, ...).


    --
    Oscar Kind http://home.hccnet.nl/okind/
    Software Developer for contact information, see website

    PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
     
    Oscar kind, Feb 13, 2005
    #2
    1. Advertising

  3. Thomas Weidenfeller, Feb 14, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marco Liedekerken

    Undo in TextBox

    Marco Liedekerken, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,379
    Marco Liedekerken
    Jun 26, 2003
  2. john farrow

    How do I undo WebRequest.RegisterPrefix

    john farrow, Apr 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    878
    john farrow
    Apr 13, 2004
  3. tshad

    Undo formatting

    tshad, Apr 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    1,095
    tshad
    Apr 13, 2005
  4. Morgan Bachu

    How to "undo" a database delete

    Morgan Bachu, Aug 30, 2005, in forum: ASP .Net
    Replies:
    13
    Views:
    10,685
    James Doughty
    Aug 31, 2005
  5. Andreas Wachhold

    Undo/Redo Java?

    Andreas Wachhold, May 4, 2004, in forum: Java
    Replies:
    2
    Views:
    4,962
    Mykola Rabchevskiy
    May 4, 2004
Loading...

Share This Page