Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Advice for Undo/Redo/Cut/Copy/Paste functionality

843805Mar 27 2007 — edited Mar 27 2007
Hello,

I would like to add Undo/Redo/Cut/Copy/Paste functionality to my application.

In most applictions you have an "Edit" menu in the menubar and popups when you right click textfields. This is what I would like to become, but not only for textfields. Also for other components like a JList, JTree, ...

I don't really know how to make this, but I've already made 2 classes:

KEditPopupMenu: http://www.pastebin.be/7290/
KEditPopupMenuMouseListener: http://www.pastebin.be/7291/

KEditPopupMenu is the a popupmenu that appears when you right click a component. KEditPopupMenuMouseListener is the MouseListener that you must add to the component where you want the Undo/Redo/Cut/Copy/Paste functionality.

Now, I don't really know how to make this Undo/Redo/Cut/Copy/Paste functionality. I think I'll have to use the (Windows) clipboard, but how can I manage this etc.? This could work for Cut/Copy/Paste, but it won't work for Undo/Redo actions. Can anyone give me some more tips or information?

Kind regards,
Sweepee

PS I know that Windows already has Cut/Copy/Paste functionality in several components by using Ctrl + X, Ctrl + C, Ctrl + V, but I want to control it in my Java application.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 24 2007
Added on Mar 27 2007
2 comments
234 views