private void jbInit() throws Exception { setTitle("Privacy Settings"); this.setSize(new Dimension(480, 160)); _separator.setBounds(new Rectangle(10, 60, 460, 1)); _buttonCancel.setLocation(165, 70); _buttonCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { _buttonCancel_actionPerformed(actionEvent); } }); _buttonOkay.setLocation(280, 70); _buttonOkay.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { _buttonOkay_actionPerformed(actionEvent); } }); _checkBoxInvisible.setBounds(new Rectangle(10, 15, 230, 35)); _checkBoxUpdateLocation.setBounds(new Rectangle(245, 15, 230, 35)); _panelContent.add(_checkBoxInvisible, null); _panelContent.add(_checkBoxUpdateLocation, null); _panelContent.add(_separator, null); _panelContent.add(_buttonOkay, null); _panelContent.add(_buttonCancel, null); _checkBoxInvisible.setChecked(!Session.getInstance().getUserInfo().isLocationIsVisible()); _checkBoxUpdateLocation.setChecked(Settings.getInstance().getDTO().isUpdateMyLocation()); }
private void _buttonOkay_actionPerformed(ActionEvent actionEvent) { InfoUserTypeVO newInfoUserTypeVO = new InfoUserTypeVO(); newInfoUserTypeVO.setLocationIsVisible(!_checkBoxInvisible.isChecked()); try { API.getInstance().getUser().infoSet(Session.getInstance().getUserInfo(), newInfoUserTypeVO); } catch (Exception exception) { getParentPanel() .showWindow( new WarningWindow( "Unable to save", "Unable to save privacy settings. Please try it later.", 30, "privacy-settings-unable-to-save-warning.wav")); return; } try { Session.getInstance().setUserInfo(API.getInstance().getUser().infoGet(null)); } catch (Exception exception) { Debug.displayStack(this, exception); } Settings.getInstance().getDTO().setUpdateMyLocation(_checkBoxUpdateLocation.isChecked()); Settings.getInstance().save(); _buttonWindowClose_actionPerformed(null); }