I’m not really sure how to go about this and I don’t think I’m looking in the right direction.
I have a swing form that contains quite a large number of fields and I want to save these fields in a secondary Save class when the user presses the Save button.
Is there a way I can pass the entire contents of the Swing form to the Save Class?
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
SaveMap.MapSave(???);
}
});
Then:
public class SaveMap {
public static boolean MapSave(???) {
// save stuff
}
}
Not easily. It also depends on what you are trying to save.
Difference controls will provide different data.
Basically, I would create some kind of “builder” that could that could the “name” of the field and either the control itself or it’s value…
This has the benifit of allowing to extract the information you need in the way you need it…
or
Obviously, the
SaveMapwould need to be able to extract the property names and values.