* @param window the window who's settings to save
* @param id a unique ID for these settings.
* @param windowClass Any class. Just used for the preferences mechanism to obtain an instance. Making this an argument gives you more flexibility.
*/
public static SettingsNode restoreSettings(SettingsNode settingsNode, Window window, String id, Class windowClass) {
SettingsNode childNode = settingsNode.getChildNode(getPrefix(windowClass, id));
if (childNode == null) {
return null;
}
int x = childNode.getValueOfChildAsInt(WINDOW_X, window.getLocation().x);
int y = childNode.getValueOfChildAsInt(WINDOW_Y, window.getLocation().y);
int width = childNode.getValueOfChildAsInt(WINDOW_WIDTH, window.getSize().width);
int height = childNode.getValueOfChildAsInt(WINDOW_HEIGHT, window.getSize().height);
window.setLocation(x, y);
window.setSize(width, height);
return childNode;