I am new to Java Swing and I am creating a window which displays a list of items retrieved from an XML file that can be manipulated by the user.
The window should have a Cancel and a Save functionality implemented with buttons. While the Save functionality is straightforward (just close the window) I don’t know how to implement the Cancel functionality. Does exist an “undo” function? Does anyone know how?
I am new to Java Swing and I am creating a window which displays
Share
it depends on whether you have a modal or modeless window/dialog
for a modal/dialog window you should ask the other way around:
first store you values when the user clicks save/OK.
for a modeless window you could hold a copy of your data thats editable in the window in your window and save when the user clicks save and do nothing when the user clicks Cancel