/** Creates new form EditContactPanel */ public EditContactPanel() { initComponents(); // if not Substance LaF, add clipboard popup menu to text components if (!config.getLookAndFeel().equals(ThemeManager.LAF.SUBSTANCE)) { ClipboardPopupMenu.register(nameTextField); ClipboardPopupMenu.register(numberTextField); } // listen for changes in number and guess gateway numberTextField .getDocument() .addDocumentListener( new AbstractDocumentListener() { @Override public void onUpdate(DocumentEvent e) { boolean usrSet = userSet; if (!userSet) { gatewayComboBox.selectSuggestedGateway(numberTextField.getText()); } gatewayComboBox.setFilter(numberTextField.getText()); userSet = usrSet; updateCountryInfoLabel(); updateSuggestGatewayButton(); EditContactPanel.this.revalidate(); } }); // on keyring update update credentialsInfoLabel keyring.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateCredentialsInfoLabel(); EditContactPanel.this.revalidate(); } }); // when some info label is shown or hidden, update the frame size ComponentListener resizeListener = new ComponentAdapter() { @Override public void componentHidden(ComponentEvent e) { askForResize(); } @Override public void componentShown(ComponentEvent e) { askForResize(); } private void askForResize() { actionSupport.fireActionPerformed(ActionEventSupport.ACTION_NEED_RESIZE, null); } }; for (Component comp : infoPanel.getComponents()) { comp.addComponentListener(resizeListener); } // update components gatewayComboBoxActionPerformed(null); }